示例#1
0
 private void ResetShaderSettings(GrassSettings grassSettings, GrassManager grassManager)
 {
     if (grassSettings == null)
     {
         return;
     }
     if (grassSettings.useAuto)
     {
         if (grassManager == null)
         {
             return;
         }
         EditorUtility.SetDirty(grassSettings);
         AssetDatabase.SaveAssets();
         grassManager.CorrectShaderSettings();
         grassManager.CorrectGrassMaterialSettings();
         if (grassManager.grassMaterial != null)
         {
             grassManager.grassMaterial.SetMaterialToGrass();
         }
     }
     else
     {
         EditorUtility.SetDirty(grassSettings);
         AssetsManager.SetGrassShaderSettings(true, grassSettings.useSimple, grassSettings.useFull);
     }
 }
示例#2
0
        private void ShowGUI()
        {
            materialFoldout = EditorGUILayout.Foldout(materialFoldout, "Material", true, EditorGUIHelper.foldoutStyle);
            if (materialFoldout)
            {
                EditorGUILayout.PropertyField(new SerializedObject(myTarget).FindProperty("grassMaterial"));

                if (myTarget.grassMaterial != null)
                {
                    myTarget.grassMaterial.SetMaterialToGrass();
                }
                myTarget.CorrectGrassMaterialSettings();
            }
            EditorGUILayout.Space();

            physicsFoldout = EditorGUILayout.Foldout(physicsFoldout, "Physics", true, EditorGUIHelper.foldoutStyle);
            if (physicsFoldout)
            {
                myTarget.grassPhysics = EditorGUILayout.ObjectField("Grass Physics Script", myTarget.grassPhysics, typeof(GrassPhysics), true) as GrassPhysics;

                CorrectTabs();
                myTarget.grassMode = (GrassPhysicsMode)GUILayout.Toolbar((int)myTarget.grassMode, tabNames);

                if (myTarget.grassMode == GrassPhysicsMode.Full && AssetsManager.IsLowEndPlatform())
                {
                    EditorGUILayout.HelpBox(fullPhysicsWarningForLowEndPlatform, MessageType.Warning);
                }
            }
        }