コード例 #1
0
ファイル: Pause.cs プロジェクト: DanielKeehn/FarmTowerDefense
 // Get a reference to the UI manager
 private void Start()
 {
     try {
         uIManager = GameObject.FindWithTag("UIManager").GetComponent <Menu.UIManager>();
     }
     catch {
         throw new System.ArgumentException("Couldn't Find The UI Manager Script");
     }
 }
 private void Start()
 {
     pauseScript = gameObject.GetComponent <Pause>();
     if (pauseScript == null)
     {
         throw new System.ArgumentException("Couldn't find reference to pause script. Make sure this component and a pause script is inside the game manager");
     }
     try {
         uIManager = GameObject.FindWithTag("UIManager").GetComponent <Menu.UIManager>();
     } catch {
         throw new System.ArgumentException("Couldn't find UI Manager, make sure you have a UI Manager Object with tag and UI Manager Script");
     }
 }
コード例 #3
0
    // Start is called before the first frame update
    void Start()
    {
        try {
            uIManager = GameObject.FindWithTag("UIManager").GetComponent <Menu.UIManager>();
        }
        catch {
            throw new System.ArgumentException("Couldn't Find The UI Manager Script");
        }

        gameManager = GameObject.FindWithTag("GameManager").GetComponent <GameManager>();
        if (gameManager == null)
        {
            throw new System.ArgumentException("Couldn't Find The Game Manager Script");
        }

        pause = gameObject.GetComponent <Pause>();
        if (pause == null)
        {
            throw new System.ArgumentException("Couldn't Find Pause Script");
        }
    }