When I run this, it makes it to half way of the camera then Unity stops responding.
//This whole code below is used to have a Retro Mario sort of camera where if it hits halfway of the camera, it pushes the camera, but when it's behind it, the camera stays in place.
  using UnityEngine;
  using System.Collections;
 public class CameraControl : MonoBehaviour {
 public GameObject player;
 public GameObject daycycle;
 private float offsetz;
 // Use this for initialization
 void Start () {
     offsetz = transform.position.z + player.transform.position.z;
 }
 
 // Update is called once per frame
 void Update () {
     while (player.transform.position.z >= transform.position.z)
     {
         transform.position = new Vector3(transform.position.x, transform.position.y, player.transform.position.z));
     }
     if (player.transform.position.z <= (transform.position.z - 97))
     {
         transform.position = new Vector3(transform.position.x, transform.position.y,transform.position.z);
     }
     
 }
 }
 
              
               Comment
              
 
               
              Your answer