Exemplo n.º 1
0
    public void SetActive(bool active, Mesh mesh = null)
    {
        gameObject.SetActive(active);
        meshFilter.sharedMesh = mesh;

        if (active)
        {
            if (addCollider == AddColliderMode.Delayed)
            {
                Invoke("AddCollider", ChunkPool.GetBusyCount() * delay);
            }
            else if (addCollider == AddColliderMode.Immediate)
            {
                AddCollider();
            }
            else if (addCollider == AddColliderMode.DelayedOnReuse)
            {
                AddCollider();
                addCollider = AddColliderMode.Delayed;
            }
        }
        else
        {
            meshCollider.sharedMesh = null;
        }
    }