A MQTT client with blueprint support for Unreal Engine 4, based on Mosquitto.
Because this has not been developed as a plugin, the installation process is slightly very cumbersome. Only Windows x64 is supported so far.
- Make sure your project is set-up for C++. If it's not already the case, add a simple C++ Actor in Unreal that you could remove later.
- Add the
ThirdParty
folder to the UnrealProject. - Edit your project's build file, named
YourProjectName.Build.cs
in theSource/YourProjectName
folder. The changes are based on theSource/ProjectName/ProjectName.Build.cs
file.- Add the
using System.IO;
- Add the two new methods
ThirdPartyPath
andLoadThirdPartyDLL
. - Add the two
LoadThirdPartyDLL
at the end of the constructor.
- Add the
- Add the source files in the
Source/ProjectName/Private
andSource/ProjectName/Public
folders to your respectiveSource/YourProjectName/Private
andSource/YourProjectName/Public
folders. - In these files, replace all occurences of
ProjectName
byYourProjectName
andPROJECTNAME_API
byYOURPROJECTNAME_API
. - Finally, add the
mosquitto.dll
andmosquittopp.dll
in theBinaries/Win64
folder. You can find these two DLLs in theThirdParty
subfolders, but you will have to to remove.x64
from their pathname. - Right-click on
YourProject.uproject
file, and selectGenerate Visual Studio Project files
. - Open
YourProject.sln
and compile everything. - (Re)Start the Unreal Engine Editor.
To use the MQTT client, the simplest method is to create a blueprint child class from it.
- Find the C++ Unreal Mosquitto class in the content browser.
- Right click and select
Create Blueprint class based on UnrealMosquitto
.
This new child class has access to the events in its event graph. You can also configure the client in the MQTT section in the details panel of the root element. The router can dispatch executions flows based on MQTT topics.