DynamicCrosshair.cs
just change theunknown
plain_text
3 years ago
717 B
1
Indexable
Never
using UnityEngine; public class DynamicCrosshair : MonoBehaviour { public GameObject crosshair; MouseOver mouseOverScript; void Start() { mouseOverScript = FindObjectOfType<MouseOver>(); } void OnTriggerEnter(Collider jennyCollider) { if(jennyCollider.tag == "Player" && mouseOverScript.mouseOver == true) { Debug.Log("Both true"); crosshair.SetActive(true); } else { Debug.Log("TriggerTag Player but no mouseOver"); crosshair.SetActive(false); } } void OnTriggerExit(Collider jennyCollider) { Debug.Log("TriggerExit"); crosshair.SetActive(false); } }