using PMaker.DependencyInjection; using PMaker.Extension; using PMaker.Set; using Sirenix.OdinInspector; using System.Collections.Generic; using System.Linq; using UnityEngine; public class RuntimeObjectSetInitializer : BaseBehaviour { public List objects = new List(); [ReadOnly] [SerializeField] private Dictionary _mapper; private void Awake() { this._mapper = new Dictionary(); foreach (var obj in objects) { this._mapper.Add(obj.name, obj); } } private void OnEnable() { IoC.GetSingleton()?.subObjectSetMapper.Add(_mapper); } private void OnDisable() { IoC.GetSingleton()?.subObjectSetMapper.Remove(this._mapper); } [Button] public void GetChildren() { var gos = this.transform.Children().Select(_=>_.gameObject); this.objects = gos.ToList(); } }