Unity editor got hang after put some code in camera and click play
Hi, I have a case that make me really confused. Maybe this is a basic question/problem, but I couldn't find the answer. The Unity Editor got hang when I put this script below into camera:
using UnityEngine;
public class CameraController : MonoBehaviour { public GameObject player; private Vector3 offset;
void Start()
{
offset = transform.position - player.transform.position;
}
void LateUpdate()
{
transform.position = player.transform.position + offset;
} }
The Editor working properly before I put the script or if I remove the script. I can click play button and works normally. But when I put the script, the Editor will totally hang and I have to kill the apps thru Windows Task Manager.
I'm using Unity 2019.4.10f1 on Windows 10.
I really need an advise for that case. Thank you.
Your answer
Follow this Question
Related Questions
Scene view visual glitch, multiplying objects (like WindowsXP bug) 1 Answer
Can't restore camera preview 0 Answers
Why the decimals change when I move away from the object? 0 Answers
Why Does Preference Item Restart whenever project is updated or played 0 Answers
ScreenToWorldPoint works wrong after updating to 2019.3.5 1 Answer