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); } }
/// <summary> /// Changes grass physics script to correspond to grass physics mode if it doesn't /// </summary> private void SetCorrectScript() { switch (myTarget.grassMode) { case GrassPhysicsMode.Simple: { ChangePhysicsScriptTo <GrassSimplePhysics>(); break; } case GrassPhysicsMode.Full: { ChangePhysicsScriptTo <GrassFullPhysics>(); break; } default: { if (myTarget.grassPhysics != null) { DestroyImmediate(myTarget.grassPhysics, true); } break; } } myTarget.CorrectShaderSettings(); GUIUtility.ExitGUI(); }