using System.Collections; using System.Collections.Generic; using UnityEngine; public class FollowShowOrHide : MonoBehaviour { public GameObject Follow; // Update is called once per frame void Update() { if(this.transform.localPosition.z>0) this.GetComponent<MeshRenderer>().enabled=Follow.activeSelf; else { this.GetComponent<MeshRenderer>().enabled=true; } } }