using UnityEngine; using UnityEngine.Tilemaps; namespace GeometryTD.Map { [DisallowMultipleComponent] public class MapDataRefs : MonoBehaviour { [SerializeField] private Tilemap _tilemap = null; [SerializeField] private Spawner[] _spawners = null; [SerializeField] private House _house = null; public Tilemap Tilemap => _tilemap; public Spawner[] Spawners => _spawners; public House House => _house; #if UNITY_EDITOR private void OnValidate() { if (_tilemap == null) { _tilemap = GetComponentInChildren(true); } if (_spawners == null || _spawners.Length == 0) { _spawners = GetComponentsInChildren(true); } if (_house == null) { _house = GetComponentInChildren(true); } } #endif } }