diff --git a/MyScriptsManager/Editor/MyScriptsManagerEditor.cs b/MyScriptsManager/Editor/MyScriptsManagerEditor.cs index 31c1807..09b956e 100644 --- a/MyScriptsManager/Editor/MyScriptsManagerEditor.cs +++ b/MyScriptsManager/Editor/MyScriptsManagerEditor.cs @@ -1,8 +1,7 @@ -using UnityEngine; +using UnityEngine; using System.Collections; using UnityEditor; using System.Collections.Generic; -using NUnit.Framework; public class MyScriptsManagerEditor : EditorWindow { @@ -14,10 +13,7 @@ static void Init() { GetWindow(typeof(MyScriptsManagerEditor)).minSize = new Vector2(250,200); GetWindow(typeof(MyScriptsManagerEditor)).titleContent = new GUIContent("All Scripts v0.1"); } - public MyScriptsManagerEditor() - { - - } + GUIStyle styleHelpboxInner; GUIStyle titleLabel,editorAddedButtonStyle,normalButtonStyle; @@ -57,17 +53,34 @@ public void UpdateList() objects = FindObjectsOfTypeAll( typeof( Component ) ); foreach( Component component in objects ) { - if(component.GetType().BaseType.ToString().Equals("UnityEngine.MonoBehaviour")) + if(component.GetType().BaseType.ToString().Equals("UnityEngine.MonoBehaviour") && IsInsideProject(component.GetType().Name)) { - if( !sets.ContainsKey( component.GetType() ) ) + if( !sets.ContainsKey( component.GetType() )) { sets[ component.GetType() ] = new ArrayList(); } ( ( ArrayList )sets[ component.GetType() ] ).Add( component.gameObject ); } } - } + + bool IsInsideProject(string fileName) + { + List tempPaths = new List(); + string[] guids = AssetDatabase.FindAssets ("t:Script"); + tempPaths = new List(); + foreach (var itemPath in guids) + { + tempPaths.Add(AssetDatabase.GUIDToAssetPath(itemPath)); + } + + for (int count = 0; count < tempPaths.Count; count++) { + if(tempPaths[count].Contains(fileName)) + return true; + } + return false; + } + List pathOfScripts; void OnGUI() { @@ -130,9 +143,4 @@ string getPathOfFile(string tempName) } return "NaN"; } - - - - - }