Esempio n. 1
0
 // Use this for initialization
 void Start()
 {
     //screenController = gameObject.AddComponent<ScreenController> (); // AddComponent adds other gameobjects to the current of type classname
     //screenController = gameObject.GetComponent<ScreenController> ();
     screenController = GameObject.Find ("Main Camera").GetComponent<ScreenController>();
     /*
      * the above line basically finds a game object called Main Camera, and gets a component which we specify to be ScreenController
      * since ScreenController was instantiated by Main Camera, Start and Update works and will give off the proper values here when we call the getter functions
      * there is AddComponent, GetComponent and Instantiate, 2 of these adds a "new" object/element
     */
     ScreenHeight = screenController.GetScreenHeight();
     ScreenWidth = screenController.GetScreenWidth();
     //Debug.Log (ScreenHeight  + ", " + ScreenWidth);
 }