private void Awake() { // Set up the reference. ball = GetComponent<Ball> (); // get the transform of the main camera if (Camera.main != null) { cam = Camera.main.transform; } else { Debug.LogWarning ( "Warning: no main camera found. Ball needs a Camera tagged \"MainCamera\", for camera-relative controls."); // we use world-relative controls in this case, which may not be what the user wants, but hey, we warned them! } }