I’m trying to extend the UE to support an alternate form of input. I have a DLL which processes the input and the plan is to write a class in Unreal which communicates with the DLL, interprets the data and has UE4 perform the requested action.
I have done this before in Unity, I’m trying to transition over to UE4
In Unity, to call a function from a DLL you must load the the process (using its equivalents of GetDllExpots and GetDllHandle). I had a crazy realization… my DLL is in C++, Unreal compiles C++, so instead of performing run time dynamic linking by calling those barbaric GetDll functions, I used load time dynamic linking. Here is a nice resource
As you say, let the compiler deal with it
Currently I am able to have my alternate input method interact with UE4, but Im doing it in the sketchiest way. I created an Actor class and in the Tick function I invoke my DLL’s update function. Here is the code:
void AFilmTIMEDLLActor::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
FVector lPos = updateFT(); // DLL function
SetActorLocation(lPos);
}
Super simple I know, baby steps
Now this is less than optimal because as expected, this means my DLL only works when the game is playing. It should be updating all the time, even if the game isn’t playing. This is something I need to fix in the future, but again, baby steps.
Also another problem I had was I couldn’t get Unreal to find my DLL, on engine startup it would throw a DLL not found error and terminate itself. My less than optimal solution was to put my DLL in the same directory as UE4Editor.exe.
Another problem I currently have is my DLL only works once, that is if I press play my updateFT function (above) works. If I stop and play again, it doesn’t, need to restart UE4.
Problems man. Im learning though