浏览代码

Fixed Search for disabled objects

/main
Thomas ICHÉ 6 年前
当前提交
2397b1f3
共有 1 个文件被更改,包括 18 次插入8 次删除
  1. 26
      Editor/FindAndReplace/FindAndReplaceWindow.cs

26
Editor/FindAndReplace/FindAndReplaceWindow.cs


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)

正在加载...
取消
保存