📜  自定义游戏启动器和视频游戏之间的通信 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:38.333000             🧑  作者: Mango

代码示例1
There are probably dozens of ways to achieve this. The simplest I can think of is to just write it to a text file and open that file within the game during BeginPlay() and clear/delete the text file after its read.

You could also send the data via sockets locally but would definitely be more work if you don’t already have custom socket code integrated.

You could probably also open the game using custom command line arguments but I’ve never done this myself so I can’t give any examples unfortunately. I couldn’t imagine this being very difficult.

There are tons of ways to pass info from one application to another it really depends on what works best for you! Hope this at least gives you a starting point!
For getting command line arguments you can use "Get Command Line" https://docs.unrealengine.com/en-US/BlueprintAPI/Utilities/GetCommandLine/index.html

There's also "Has Launch Option" to see if a particular option exists (options being something like -game or -demomode) https://docs.unrealengine.com/en-US/BlueprintAPI/Utilities/HasLaunchOption/index.html