Example #1
0
        public static void ShowWindow()
        {
            GrassWindow window = GetWindow <GrassWindow>("Grass Settings");
            string      path   = AssetsManager.GetGrassAssetPath()
                                 + (EditorGUIUtility.isProSkin?"/Icons/GrassLightIco.png":"/Icons/GrassDarkIco.png");
            Texture2D texture = AssetDatabase.LoadAssetAtPath <Texture2D>(path);

            window.titleContent.image = texture;
            window.titleContent.text  = "Grass Settings";
        }
Example #2
0
        /// <summary>
        /// Sets (global) <see cref="GrassMaterialProfile"/> settings if current <see cref="GrassManager"/> is not a prefab
        /// </summary>
        public void CorrectGrassMaterialSettings()
        {
            if (IsPrefabOrMultipleManagers())
            {
                return;
            }

            string shaderPath = AssetsManager.GetGrassAssetPath() + "/Shaders/WavingGrassPhysics.shader";

            System.Type materialType = null;
            if (grassMaterial != null)
            {
                materialType = grassMaterial.GetType();
            }
            AssetsManager.SetGrassFragmentInclude(GrassMaterialAttribute.GetFragmentShaderFromClassType(materialType));
            AssetsManager.SetSurfInShaderFile(shaderPath, GrassMaterialAttribute.GetSurfFromClassType(materialType));
        }
Example #3
0
        /// <summary>
        /// Returns <see cref="GrassSettings"/> scriptable object from "Settings" folder
        /// </summary>
        /// <returns>Grass mode settings</returns>
        public static GrassSettings GetGrassSettings()
        {
            string settingsPath = AssetsManager.GetGrassAssetPath() + "/Settings/GrassSettings.asset";

            return(AssetsManager.LoadOrCreateObject(settingsPath, typeof(GrassSettings)) as GrassSettings);
        }