using UnityEngine; using UnityEditor; public static class ApplyCartoonFireShader { [MenuItem("Tools/Apply Cartoon Fire Shader")] public static void Apply() { string materialPath = "Assets/Materials/Fire_Material.mat"; Material mat = AssetDatabase.LoadAssetAtPath(materialPath); if (mat == null) { Debug.LogError($"Material not found at {materialPath}"); return; } Shader cartoonShader = Shader.Find("Custom/CartoonFire"); if (cartoonShader == null) { Debug.LogError("Shader Custom/CartoonFire not found! Make sure it compiled successfully."); return; } Undo.RecordObject(mat, "Apply Cartoon Fire Shader"); mat.shader = cartoonShader; // Set properties mat.SetColor("_ColorOuter", new Color(1.5f, 0.2f, 0.1f, 1.0f)); mat.SetColor("_ColorMid", new Color(1.8f, 0.55f, 0.0f, 1.0f)); mat.SetColor("_ColorInner", new Color(2.2f, 0.95f, 0.15f, 1.0f)); mat.SetVector("_Speed", new Vector4(0.0f, -1.8f, 0.0f, 0.0f)); mat.SetFloat("_DistortStrength", 0.08f); mat.SetFloat("_ThresholdOuter", 0.15f); mat.SetFloat("_ThresholdMid", 0.38f); mat.SetFloat("_ThresholdInner", 0.58f); mat.SetFloat("_NoiseScale", 15.0f); EditorUtility.SetDirty(mat); AssetDatabase.SaveAssets(); Debug.Log("Successfully applied CartoonFire shader to Fire_Material.mat and set default values!"); } }