Пример #1
0
        private IEnumerator RemoveInstancesAtRuntime()
        {
            for (int i = 0; i < instanceCount; i++)
            {
                if (!instancesList[instancesList.Count - 1].prefabPrototype.addRuntimeHandlerScript)
                {
                    GPUInstancerAPI.RemovePrefabInstance(prefabManager, instancesList[instancesList.Count - 1]);
                }
                Destroy(instancesList[instancesList.Count - 1].gameObject);
                instancesList.RemoveAt(instancesList.Count - 1);
                if (!addRemoveInstantlyToggle.isOn)
                {
                    yield return(new WaitForSeconds(0.001f));
                }
            }

            EnableButton("AddInstancesButton");
            if (extraInstancesList.Count == 0)
            {
                EnableButton("AddExtraInstancesButton");
            }
            else
            {
                EnableButton("RemoveExtraInstancesButton");
            }
        }