Unityで https://qiita.com/nmxi/items/7950fb12ef925efa276d を参考にして作っています。
実行すると少しだけ動いてフリーズします。
発生している問題・エラーメッセージ
UnassignedReferenceException:The variable masterObj of Destroyer has not been assigned. You probably need to assign the masterObj variable of the Destroyer script in the inspector.
該当のソースコード
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4 5public class Destroyer : MonoBehaviour 6{ 7 8 public GameObject masterObj; 9 10 11 // Start is called before the first frame update 12 void Start() 13 { 14 15 } 16 17 // Update is called once per frame 18 void Update() 19 { 20 21 } 22 private void OnCollisionEnter(Collision collision) 23 { 24 masterObj.GetComponent<GameMaster>().boxNum--; 25 Destroy(gameObject); 26 27 } 28}
試したこと
再起動して実行
補足情報(FW/ツールのバージョンなど)
Unity 2019.03.0a5 Personal
###補足です。
下記画像のカメラに映ている真ん中の一番大きいboxのみ着色させて、
後ろにある、小さいboxは着色しないようにしたいです。

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。