EgoCleanUp.CleanUp C# (CSharp) Method

CleanUp() public static method

public static CleanUp ( ) : void
return void
    public static void CleanUp()
    {
        // Destroy Components
        foreach( var cleanUp in _cleanUps )
        {
            cleanUp();
        }

        // Destroy GameObjects
        foreach (var gameObject in _destroyedGameObjects)
        {
            UnityEngine.Object.Destroy(gameObject);
        }
        _destroyedGameObjects.Clear();
    }

Usage Example

コード例 #1
0
    public static void Start()
    {
        // Attach an EgoComponent Component to each GameObject
        var gameObjects   = Object.FindObjectsOfType <GameObject>();
        var egoComponents = new List <EgoComponent>();

        foreach (var gameObject in gameObjects)
        {
            var egoComponent = gameObject.GetComponent <EgoComponent>();
            if (!egoComponent)
            {
                egoComponent = gameObject.AddComponent <EgoComponent>();
            }
            egoComponent.CreateMask();
            egoComponents.Add(egoComponent);
        }

        // Create System bundles
        foreach (var system in _systems)
        {
            system.CreateBundles(egoComponents.ToArray());
        }

        // Start all Systems
        foreach (var system in _systems)
        {
            system.Start();
        }

        // Invoke all queued Events
        EgoEvents.Invoke();

        // Clean up Destroyed Components & GameObjects
        EgoCleanUp.CleanUp();
    }
All Usage Examples Of EgoCleanUp::CleanUp