bidirectional link between java application and an unreal game
I am thinking about making a bidirectional link between a java application which controls some parts of an unreal game. Setting and getting game values. Probably a dll can make it. I know how to use a dll in an unreal game and in a java application.
I don't know how to call a game method by the java application. E.g. I want to read the window size of the game or set the player's position. Would be callbacks, provided by the dll to the game, a solution?
asked Aug 09 '17 at 08:41 PM in C++ Programming
In case someone else needs this here is how it's done. This link between c++ and java made possible with jni. The easiest way to access java is to modify game activity class with upl using a tag . For example:
Then in c++ function you call:
You need to know the sinature of java function, you can find it here. This is a common knowledge that could be found, I just summarised it. What I couldn't find is how to call back from java to c++ and here is how you do it. Again using simply game activity you add function declaration of c++ method in java as described previously:
In c++(I used the same file from where I call java class) you do the following:
Now you can call function howToGetString("a string ") and it will call you c++ class. I used it in OnActivityResult to get data from my intent. Hope this will help someone.
answered May 31 '18 at 02:13 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here