SingleInstace Application "on new instance start" parameter callback

Hi,

for the first application instance its easy to retrieve the start params from Environment.CommandLine. But for a forced single instance Application a second start with different params is not given to the running instance.

For UWP this might be possible with the Application.deepLinkActivated Callback Unity - Scripting API: Application.deepLinkActivated but thats not working on Windows standard apps.

A workaround might be to have a second application which starts the unity application and in case of allready running it uses NamedPipes to pass the params to the instance.

I think it would be much easier for unity to implement a callback for that as they allready handle the force single instance… may be just use the deepLinkActivated callback even if it not a real deeplink.

So whom could I tell this to get it into your backlog :smile: ?

Greetings
Philipp

You could also modify the game executable to save the parameters off somewhere before calling UnityMain() and pass them to your main app. That wouldn’t require a secondary app.

How?

The source code for the executable is shipped inside Editor\Data\PlaybackEngines\windowsstandalonesupport\ Source. You can then modify it and recompile it.

@LPhilipp Hello! Did you manage to solve the issue? I’ve got the same question posted btw How to get command line arguments for a running app (non UWP)?