using System.Collections; using System.Collections.Generic; using UnityEngine; public class SpawnWatcher : MonoBehaviour { public bool spawnIsFree; public List consideredTags; // Start is called before the first frame update void Start() { this.spawnIsFree = true; } // Update is called once per frame void Update() { } private void OnTriggerEnter(Collider other) { if (this.consideredTags.Contains(other.tag)) { //Debug.Log("Spawn isn´t free because " + other.tag); this.spawnIsFree = false; } } private void OnTriggerExit(Collider other) { if (this.consideredTags.Contains(other.tag)) { //Debug.Log("Spawn is free again because " + other.tag); this.spawnIsFree = true; } } }