Skip to content

Commit

Permalink
Update MyScriptsManagerEditor.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
prashant-singh authored Jan 4, 2017
1 parent 8985675 commit fe882a8
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions MyScriptsManager/Editor/MyScriptsManagerEditor.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using UnityEngine;
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.Collections.Generic;
using NUnit.Framework;


public class MyScriptsManagerEditor : EditorWindow {
Expand All @@ -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;
Expand Down Expand Up @@ -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<string> tempPaths = new List<string>();
string[] guids = AssetDatabase.FindAssets ("t:Script");
tempPaths = new List<string>();
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<string> pathOfScripts;
void OnGUI()
{
Expand Down Expand Up @@ -130,9 +143,4 @@ string getPathOfFile(string tempName)
}
return "NaN";
}





}

0 comments on commit fe882a8

Please sign in to comment.