Burnner

Untitled

Apr 11th, 2015
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEditor;
  3. using UnityEditor.Callbacks;
  4.  
  5. public class EditorPostProcessor
  6. {
  7.     /*This Script will autoremove all helper scripts */
  8.  
  9.     [PostProcessScene]
  10.     public static void OnPostprocessScene()
  11.     {
  12.         GameObject[] allgo = GameObject.FindObjectsOfType(typeof(GameObject)) as GameObject[];
  13.         for (int i = 0; i < allgo.Length; i++)
  14.         {
  15.             if(allgo[i].GetComponent<Grid>())
  16.                 Object.DestroyImmediate(allgo[i].GetComponent<Grid>());
  17.  
  18.             if (allgo[i].GetComponent<LevelEditorLayer>())
  19.                 Object.DestroyImmediate(allgo[i].GetComponent<LevelEditorLayer>());
  20.  
  21.             if (allgo[i].GetComponent<TileManager>())
  22.                 Object.DestroyImmediate(allgo[i].GetComponent<TileManager>());
  23.         }
  24.                    
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment