Advertisement
Marsh_Mello

VTOLVR ModdingUtilitys

Feb 8th, 2020
580
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  1. #if UNITY_EDITOR
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using UnityEditor;
  6. using UnityEngine;
  7.  
  8. public class ModdingUtilitys : MonoBehaviour
  9. {
  10.     [MenuItem("VTOLVR Modding/Fix Materials")]
  11.     public static void FixMaterials()
  12.     {
  13.         Material[] mats = Resources.FindObjectsOfTypeAll(typeof(Material)) as Material[];
  14.         int nullCount = 0;
  15.         Shader standardShader = Shader.Find("Standard");
  16.         for (int i = 0; i < mats.Length; i++)
  17.         {
  18.             if (mats[i].shader.name == string.Empty)
  19.             {
  20.                 mats[i].shader = standardShader;
  21.                 nullCount++;
  22.             }
  23.         }
  24.         Debug.Log($"Fixed {nullCount} shaders");
  25.     }
  26. }
  27. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement