private void Awake() { // assign the delegate function if (resize) { nextEntity = ShowResizable; } if (!resize) { nextEntity = Show; } //assign the EntityManager entityManager = World.Active.GetOrCreateManager <EntityManager>(); // create the group with the parameters we want to filter entities later m_Group = entityManager.CreateComponentGroup(typeof(Indexer), typeof(Visible)); // assign the active rendering world world = World.Active; // initialize entities(game objects) in the pool // giving the initial amount SpawnObjects(amount); }
private void OnValidate() { // validate the change of resize boolean // in order to control how new requests will be handled if (resize) { nextEntity = ShowResizable; } if (!resize) { nextEntity = Show; } // validate the group index number. // iterate all instances of PoolECS // if we find it then display error foreach (PoolECS go in FindObjectsOfType <PoolECS>()) { if (go == this) { continue; } if (go.groupIndex == groupIndex) { Debug.LogErrorFormat("Groupn Index {0} has been used in another pool, please choose another index!", groupIndex); // ping the object to highlight in hierarchy UnityEditor.EditorGUIUtility.PingObject(gameObject); // do not allow play mode since pools are not going to work UnityEditor.EditorApplication.isPlaying = false; } } }