Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class PlayerDetector : MonoBehaviour {
- [HideInInspector]
- public bool playerInRange = false;
- private void OnTriggerEnter(Collider other) {
- if (other.gameObject.CompareTag("Player")) {
- playerInRange = true;
- }
- }
- private void OnTriggerExit(Collider other) {
- if (other.gameObject.CompareTag("Player")) {
- playerInRange = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement