Does anybody know if there is a way, at Unreal’s engine level, to prevent from having multiple instances of your application running? I mean, once you have your app packaged, if you try to open multiple times the ‘exe’, the application should only launch the first time. Subsequent times, the only effect should be to gain focus of the unique instance you previously launched.
But is it possible to move the loading phase earlier?
For example, check the file lock before the window popup, so starting second instance won’t see a new blank window.
@BBB@Andrew_Bindraw I think the solution in your posts is overly complicated. Instead of using a file lock, you could just use FGenericPlatformProcess::IsFirstInstance()
If this is a Windows packaged game, a simple way is to use a named mutex. Create the mutex when the application starts; if it already exists, you know another instance is running. You can then bring the existing window to the foreground and exit the second process. For Unreal, you can do this in C++ during startup using the Windows API (CreateMutex). Just make sure the mutex name is unique to your application. This is generally more reliable than checking for the process name, since the same executable could potentially be launched from different paths.