こんにちは、
よろしくお願いします。
実現したいこと
MissingReferenceException:のエラーが出てしまいます。
###エラーの部分、
これがエラー、
MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
ChaseCamera.Update () (at Assets/Scenes/Scripts/ChaseCamera.cs:30)
ソースコード
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ChaseCamera : MonoBehaviour { public GameObject target; public Vector3 offset; void Start() { offset = transform.position - target.transform.position; } // Update is called once per frame void Update() { Debug.Log(target); transform.position = target.transform.position + offset; } } transform.position = target.transform.position + offset;のここでエラーが出てしまっています。 どの部分が間違っているのでしょうか? 詳しく教えてください。 回答よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー