|
|
|
|
|
|
using System.Linq; |
|
|
|
using System.Collections.Generic; |
|
|
|
using UnityEngine; |
|
|
|
using UnityEngine.SceneManagement; |
|
|
|
using UnityEditor; |
|
|
|
using UnityEditor.IMGUI.Controls; |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static GameObject[] FindAllSceneObjects() |
|
|
|
{ |
|
|
|
var all = Resources.FindObjectsOfTypeAll<GameObject>(); |
|
|
|
all = all.Where(o => o.scene.isLoaded).ToArray(); |
|
|
|
return all; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
switch(by) |
|
|
|
|
|
|
|
var all = FindAllSceneObjects(); |
|
|
|
|
|
|
|
switch (by) |
|
|
|
foreach(var go in FindObjectsOfType<GameObject>()) |
|
|
|
foreach(var go in all) |
|
|
|
{ |
|
|
|
if (go.name.Contains((string)criteria)) |
|
|
|
query.Add(go); |
|
|
|
|
|
|
query.AddRange(GameObject.FindGameObjectsWithTag((string)criteria)); |
|
|
|
break; |
|
|
|
case SearchBy.Layer: |
|
|
|
foreach (var go in FindObjectsOfType<GameObject>()) |
|
|
|
foreach (var go in all) |
|
|
|
{ |
|
|
|
if (go.layer == LayerMask.NameToLayer((string)criteria)) |
|
|
|
query.Add(go); |
|
|
|
|
|
|
Type t = s_assemblyTypes[(string)criteria]; |
|
|
|
if( typeof(Component).IsAssignableFrom(t)) |
|
|
|
{ |
|
|
|
Component[] components = (Component[])FindObjectsOfType(t); |
|
|
|
Component[] components = (Component[])Resources.FindObjectsOfTypeAll(t); |
|
|
|
if (!query.Contains(c.gameObject)) |
|
|
|
if (c.gameObject.scene != null && !query.Contains(c.gameObject)) |
|
|
|
query.Add(c.gameObject); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
case SearchBy.Mesh: |
|
|
|
Mesh mesh = (Mesh)criteria; |
|
|
|
foreach (var go in FindObjectsOfType<GameObject>()) |
|
|
|
foreach (var go in all) |
|
|
|
{ |
|
|
|
MeshFilter filter = go.GetComponent<MeshFilter>(); |
|
|
|
if (filter != null && filter.sharedMesh == mesh) |
|
|
|
|
|
|
break; |
|
|
|
case SearchBy.Material: |
|
|
|
Material mat = (Material)criteria; |
|
|
|
foreach (var go in FindObjectsOfType<GameObject>()) |
|
|
|
foreach (var go in all) |
|
|
|
{ |
|
|
|
Renderer renderer = go.GetComponent<Renderer>(); |
|
|
|
if (renderer != null) |
|
|
|