Ejemplo n.º 1
0
    void RemoveObjects(int amount)
    {
        Debug.Log("Removing objets ..");

        amount = Mathf.Min(amount, inspectedComponent.pool.Length);

        //...
        for (int i = inspectedComponent.pool.Length - 1; i > inspectedComponent.pool.Length - (amount + 1); i--)
        {
            DestroyImmediate(inspectedComponent.pool[i].gameObject);
        }

        Bullet[] bullets = inspectedComponent.GetComponentsInChildren <Bullet>();
        inspectedComponent.pool = bullets;
        EditorUtility.SetDirty(inspectedComponent);

        Debug.Log("Objects removed");
    }