Search Unity

SingleInstace Application "on new instance start" parameter callback

Discussion in 'Windows' started by LPhilipp, Dec 11, 2019.

  1. LPhilipp

    LPhilipp

    Joined:
    Apr 27, 2018
    Posts:
    15
    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 https://docs.unity3d.com/2019.3/Documentation/ScriptReference/Application-deepLinkActivated.html 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 :D ?

    Greetings
    Philipp
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    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.
     
  3. LPhilipp

    LPhilipp

    Joined:
    Apr 27, 2018
    Posts:
    15
    How?
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    The source code for the executable is shipped inside Editor\Data\PlaybackEngines\windowsstandalonesupport\ Source. You can then modify it and recompile it.
     
  5. hippogames

    hippogames

    Joined:
    Feb 5, 2015
    Posts:
    232