void Start() { // Find out which camera is being used. GameObject camGO = Camera.main.gameObject; // IF we have a follow slide camera, if (camGO.GetComponent <Camera_Follow_Slide> () != null) { cfs = camGO.GetComponent <Camera_Follow_Slide> (); } }
void Awake() { // Make sure we are using the correct Camera script. if (Camera.main.GetComponent <Camera_Follow_Slide> () == null) { // We do not have the correct camera so let the Developer know. Debug.Log("When using 'Slide_Camera' make sure you are using the 'Follow_Slide_Camera' script on your main camera."); // Since we are here... lets pause so this can be fixed. Debug.Break(); return; } // Reference the script. followSlideCamera = Camera.main.GetComponent <Camera_Follow_Slide> (); }
void Awake() { // Lets get our boundaries. leftBoundary = gameObject.transform.position.x - boundarySize.x / 2; rightBoundary = gameObject.transform.position.x + boundarySize.x / 2; topBoundary = gameObject.transform.position.y + boundarySize.y / 2; bottomBoundary = gameObject.transform.position.y - boundarySize.y / 2; // IF we are using the Follow_Slide_Camera. if (Camera.main.GetComponent <Camera_Follow_Slide> () != null) { // Get the Camera Follow Slide component. cameraFollowSlide = Camera.main.GetComponent <Camera_Follow_Slide> (); // We got what we need lets leave. return; } // We do not have the correct camera so let the Developer know. Debug.Log("Could not find any of the script this communicates with."); }