예제 #1
0
    // Start is called before the first frame update
    void Awake()
    {
        //Check console UI does not already exist, if it does then delete this
        if (behaviourInstance != null && behaviourInstance != this)
        {
            Destroy(this);
            return;
        }

        //Set this as the behaviour instance
        behaviourInstance = this;

        //Make sure the output text is read-only, so our
        //output cannot be edited
        outputText.readOnly = true;

#if ENABLE_INPUT_SYSTEM
        //Get our input action asset so we can get if the toggle button has been pressed
        //this is used when we are trying to process input so we don't send a command
        //if we just closed the console

        toggleConsoleInput = GetComponent <PlayerInput>()?.currentActionMap?.asset["ToggleConsole"];
#endif

        //Stop console being destroyed on load
        DontDestroyOnLoad(gameObject);
    }
 private void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(gameObject);
         return;
     }
     instance = this;
     DontDestroyOnLoad(gameObject);
 }