Tanoda
MarkResourceObjects.cs
Go to the documentation of this file.
1using UnityEngine;
2using UnityEditor;
3using System.Collections;
4using UnityEditor.Callbacks;
5
6namespace GILES.UnityEditor
7{
13 [InitializeOnLoad]
15 {
16 static MarkResourceObjects()
17 {
18 EditorApplication.projectWindowChanged += ProjectWindowChanged;
19 }
20
22 {
23 EditorApplication.projectWindowChanged -= ProjectWindowChanged;
24 }
25
26 [MenuItem("Tools/Level Editor/Rebuild Resource IDs")]
27 public static void ProjectWindowChanged()
28 {
29 double timer = Time.realtimeSinceStartup;
30 foreach(string path in pb_Config.Resource_Folder_Paths)
31 {
32 foreach(GameObject go in (UnityEngine.Object[]) Resources.LoadAll(path, typeof(GameObject)))
33 {
34 pb_MetaDataComponent md = go.GetComponent<pb_MetaDataComponent>();
35 if(!md) md = go.AddComponent<pb_MetaDataComponent>();
36
37 if( md.UpdateFileId() )
38 EditorUtility.SetDirty(go);
39 }
40 }
41 if( (Time.realtimeSinceStartup - timer) > 3f )
42 Debug.Log("Marking resources took: " + (Time.realtimeSinceStartup - timer) + " seconds");
43 }
44 }
45}
UnityEngine.Debug Debug
Definition: TanodaServer.cs:19