I’m trying to make basic setup of EOS into my Unity game, and wanted to implement checking if a game was started through Epic launcher. For Steam this is done through SteamAPI.RestartAppIfNecessary, and I figured out the EOS analogue is EOS_Platform_CheckForLauncherAndRestart.
I have downloaded and installed both OpenEOS and PlayEveryWare plugins, but neither use this function in any of their samples. I also searched everywhere on the Internet, but apart from this single page (which just says this function exists, and has no sample code):
https://dev.epicgames.com/docs/en-US/api-ref/functions/eos-platform-check-for-launcher-and-restart
there aren’t any tutorials, code samples, or any guides on how and where to properly implement this function into EOS manager script. Can somebody please help a newbie? I don’t need any other EOS functionality for now, only initialization and checking if game was started through Epic launcher.
https://dev.epicgames.com/docs/en-US/api-ref/functions/eos-platform-check-for-launcher-and-restart
Hey, immediately after EOS_Platform_Create is called, you can call this API.
EOS_EResult Result = EOS_Platform_CheckForLauncherAndRestart(FPlatform::GetPlatformHandle());
switch (Result)
{
case EOS_EResult::EOS_Success:
// Clean up as the game will be relaunched by the launcher
break;
case EOS_EResult::EOS_NoChange:
// The game was launched by the launcher
break;
case EOS_EResult::EOS_UnexpectedError:
// There was an error either checking if the game wa launched by the launcher or trying to relaunched it via the launcher - up to you on how you want to handle this - output a log message
break;
default:
// Unexpected to be here - output a log message with the result code - up to you on how you want to handle this
break;
}
The code is in C++, you’ll need to translate to C#. I don’t work on the Unity plugin, but looking at the code, it looks like the best place for this is in the EOSManager class. You could create a private function with this logic and call it at the end of the Init function before calling the InitializeOverlay function.