コード例 #1
0
    static void Init()
    {
        SearchForComponents window = (SearchForComponents)EditorWindow.GetWindow(typeof(SearchForComponents));

        window.Show();
        window.position = new Rect(20, 80, 550, 500);
    }
コード例 #2
0
    static List <ResultItem> TraverseAllPrefabsForComponent(string component)
    {
        string[] allPrefabs = SearchForComponents.GetAllPrefabs();

        List <ResultItem> listResult = new List <ResultItem>();

        foreach (string prefab in allPrefabs)
        {
            if (!prefab.Contains("Project"))
            {
                continue;
            }

            GameObject _prefab = AssetDatabase.LoadAssetAtPath(prefab, typeof(Object)) as GameObject;

            List <ResultItem> _found = RecursiveFind(prefab, _prefab, _prefab, component);

            listResult.AddRange(_found);
        }

        return(listResult);
    }