Search Unity

Unity game - exit code

Discussion in 'Scripting' started by S_P_S, Nov 15, 2016.

  1. S_P_S

    S_P_S

    Joined:
    Feb 25, 2015
    Posts:
    91
    Hello,

    How do I receive a certain exit code from a Unity game when I close the game?

    (For example: I have a Windows Forms game launcher, call the game from there and then want to send back an exit code from the game to the launcher if the game gets closed)

    best regards
     
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
  3. S_P_S

    S_P_S

    Joined:
    Feb 25, 2015
    Posts:
    91
    Maybe the game than returns some exit value, I don't know, but I need to have influence of the exit code. Atl least true/false or 1/0.
     
  4. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    AFAIK, you don't have control of the exit code of the Unity program. You're going to have to solve whatever you're doing in some other way.
     
  5. S_P_S

    S_P_S

    Joined:
    Feb 25, 2015
    Posts:
    91
    Thanks for your answer! Has someone another idea how I can transfer data from the Unity game back to my game launcher?
    (I have a Windwos Forms C# application as my game launcher and I start the game from there, now I want to send some data back from the game to the launcher. I only need to send two different states, nothing more)
     
  6. Dave-Carlile

    Dave-Carlile

    Joined:
    Sep 16, 2012
    Posts:
    967
    - Create a file, write some data to it, read the data from the other app.
    - Use some other interprocess communication technique.
     
    Kiwasi likes this.
  7. L42yB

    L42yB

    Joined:
    Dec 20, 2012
    Posts:
    34
    Application.Quit(exitCode);