예제 #1
0
    //Disable all LODVolumes and enable on all meshes.
    //UpdateLODGroup will be makes currect.
    public void ResetLODGroup()
    {
        if (transform.parent == null)
        {
            Debug.Log("Reset volume.");
        }
        if (m_LodGroup == null)
        {
            m_LodGroup = GetComponent <LODGroup>();
        }

        if (m_LodGroup == null)
        {
            return;
        }

        m_LodGroup.SetEnabled(false);

        foreach (var volumeGroup in m_VolumeGroups)
        {
            if (volumeGroup.HLODObject != null)
            {
                var meshRenderer = volumeGroup.HLODObject.GetComponent <MeshRenderer>();
                if (meshRenderer != null)
                {
                    meshRenderer.enabled = false;
                }
            }

            //if this is a leaf, all lodgroups should be turned on.
            if (childVolumes.Count == 0)
            {
                foreach (var group in volumeGroup.LODGroups)
                {
                    if (group != null)
                    {
                        group.SetEnabled(true);
                    }
                }
            }
        }

        foreach (var child in childVolumes)
        {
            child.ResetLODGroup();
        }
    }
예제 #2
0
 void Start()
 {
     m_LodGroup = GetComponent <LODGroup>();
     if (m_LodGroup != null)
     {
         m_LodGroup.SetEnabled(false);
     }
 }