UnityEditor.DetailMeshWizard.InitializeDefaults C# (CSharp) Method

InitializeDefaults() private method

private InitializeDefaults ( Terrain terrain, int index ) : void
terrain UnityEngine.Terrain
index int
return void
        internal void InitializeDefaults(Terrain terrain, int index)
        {
            DetailPrototype prototype;
            base.m_Terrain = terrain;
            this.m_PrototypeIndex = index;
            if (this.m_PrototypeIndex == -1)
            {
                prototype = new DetailPrototype();
            }
            else
            {
                prototype = base.m_Terrain.terrainData.detailPrototypes[this.m_PrototypeIndex];
            }
            this.m_Detail = prototype.prototype;
            this.m_NoiseSpread = prototype.noiseSpread;
            this.m_MinWidth = prototype.minWidth;
            this.m_MaxWidth = prototype.maxWidth;
            this.m_MinHeight = prototype.minHeight;
            this.m_MaxHeight = prototype.maxHeight;
            this.m_HealthyColor = prototype.healthyColor;
            this.m_DryColor = prototype.dryColor;
            switch (prototype.renderMode)
            {
                case DetailRenderMode.GrassBillboard:
                    Debug.LogError("Detail meshes can't be rendered as billboards");
                    this.m_RenderMode = DetailMeshRenderMode.Grass;
                    break;

                case DetailRenderMode.Grass:
                    this.m_RenderMode = DetailMeshRenderMode.Grass;
                    break;

                case DetailRenderMode.VertexLit:
                    this.m_RenderMode = DetailMeshRenderMode.VertexLit;
                    break;
            }
            this.OnWizardUpdate();
        }

Usage Example

示例#1
0
        internal static void AddDetailMesh(MenuCommand item)
        {
            DetailMeshWizard detailMeshWizard = TerrainWizard.DisplayTerrainWizard <DetailMeshWizard>("Add Detail Mesh", "Add");

            detailMeshWizard.m_Detail = (GameObject)null;
            detailMeshWizard.InitializeDefaults((Terrain)item.context, -1);
        }
All Usage Examples Of UnityEditor.DetailMeshWizard::InitializeDefaults