private int yHeight = 30; // The Y height of GUI buttons /// <summary> /// On start, try to get a local reference to the RandomEyes2D class and the scene camera /// </summary> void Start() { if (!randomEyes2D) // randomEyes2D is null { randomEyes2D = (RandomEyes2D)FindObjectOfType(typeof(RandomEyes2D)); // Try to get a local reference to RandomEyes2D } if (!mainCam) // mainCam is null { mainCam = (Camera)FindObjectOfType(typeof(Camera)); // Try to get a local reference to the scene camera } targetPosHome = target.transform.position; }
/// <summary> /// Get reference to a RandomEyes component /// </summary> void Start() { randomEyes2D = GetComponent <RandomEyes2D>(); if (randomEyes2D) { randomEyes = randomEyes2D.gameObject; } randomEyes3D = GetComponent <RandomEyes3D>(); if (randomEyes3D) { randomEyes = randomEyes3D.gameObject; } }
/// <summary> /// Get reference to a RandomEyes component /// </summary> void Start() { randomEyes2D = GetComponent<RandomEyes2D>(); if (randomEyes2D) { randomEyes = randomEyes2D.gameObject; } randomEyes3D = GetComponent<RandomEyes3D>(); if (randomEyes3D) { randomEyes = randomEyes3D.gameObject; } }
/// <summary> /// On start, try to get a local reference to the RandomEyes2D class and the scene camera /// </summary> void Start() { if (!randomEyes2D) // randomEyes2D is null randomEyes2D = (RandomEyes2D)FindObjectOfType(typeof(RandomEyes2D)); // Try to get a local reference to RandomEyes2D if (!mainCam) // mainCam is null mainCam = (Camera)FindObjectOfType(typeof(Camera)); // Try to get a local reference to the scene camera targetPosHome = target.transform.position; }