unityのゲームで衝突が起こったときにPlaneをセットアクティブにすることで爆発するmovieが流れるようにしたいのですが上手くいきません。どうしたらいいでしょうか?
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4 5public class bakudan_con : MonoBehaviour 6{ 7 public GameObject niconico; 8 public static bakudan_con instance; 9 public bool nico; 10 11 public void Shoot(Vector3 dir) 12 { 13 GetComponent<Rigidbody>().AddForce(dir); 14 } 15 16 void OnCollisionEnter(Collision other) 17 { 18 if(other.gameObject.name == "niconico") 19 { 20 nico = true; 21 } 22 } 23 24 void Start() 25 { 26 //Shoot(new Vector3(0, 300, 1000)); 27 } 28} 29
C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4using UnityEngine.UI; 5 6 7public class movie : MonoBehaviour 8{ 9 public GameObject Plane; 10 public Text timeText; 11 12 private float surviveTime; 13 14 void Start() 15 { 16 surviveTime = 0; 17 } 18 19 public void Update() 20 { 21 surviveTime += Time.deltaTime; 22 timeText.text = "Time:" + (int)surviveTime; 23 24 25 26 if (bakudan_con.instance.nico) 27 { 28 Plane.SetActive(true); 29 } 30 } 31}