UnityEditor.TerrainEditorUtility.IsLODTreePrototype C# (CSharp) Method

IsLODTreePrototype() static private method

static private IsLODTreePrototype ( GameObject prefab ) : bool
prefab UnityEngine.GameObject
return bool
        internal static bool IsLODTreePrototype(GameObject prefab)
        {
            return ((prefab != null) && (prefab.GetComponent<LODGroup>() != null));
        }

Usage Example

Exemplo n.º 1
0
        protected override bool DrawWizardGUI()
        {
            EditorGUI.BeginChangeCheck();

            bool allowSceneObjects = !EditorUtility.IsPersistent(m_Terrain.terrainData); // sometimes user prefers saving terrainData with the scene file

            m_Tree = (GameObject)EditorGUILayout.ObjectField("Tree Prefab", m_Tree, typeof(GameObject), allowSceneObjects);
            if (m_Tree)
            {
                MeshRenderer meshRenderer = m_Tree.GetComponent <MeshRenderer>();
                if (meshRenderer)
                {
                    EditorGUI.BeginDisabled(true);
                    EditorGUILayout.EnumPopup("Cast Shadows", meshRenderer.shadowCastingMode);
                    EditorGUI.EndDisabled();
                }
            }
            if (!TerrainEditorUtility.IsLODTreePrototype(m_Tree))
            {
                m_BendFactor = EditorGUILayout.FloatField("Bend Factor", m_BendFactor);
            }

            bool changed = EditorGUI.EndChangeCheck();

            if (changed)
            {
                m_IsValidTree = IsValidTree(m_Tree, m_PrototypeIndex, m_Terrain);
            }
            return(changed);
        }
All Usage Examples Of UnityEditor.TerrainEditorUtility::IsLODTreePrototype