using System.Collections; using System.Collections.Generic; using UnityEngine; public class Trigger_road: MonoBehaviour { public static bool dian = false; public GameObject obj1; public GameObject obj3; private void Start() { obj1.SetActive(false); obj3.SetActive(false); } // Start is called before the first frame update private void OnTriggerEnter(Collider other) { obj1.SetActive(true); obj3.SetActive(true); dian = true; transform.parent.parent.SendMessage("Audio_road"); } private void OnTriggerExit(Collider other) { obj1.SetActive(false); obj3.SetActive(false); dian = false; } }