找到当前场景下面所有对象

using UnityEngine;
using System.Collections;
using UnityEditor;
using UnityEngine.SceneManagement;
public class SelectionEditorDataInspector : Editor
{

    [MenuItem("Tools/删除场景触发器")]
    static void NewSelectionTest1()
    {

        GameObject[] objs = (GameObject[])Resources.FindObjectsOfTypeAll(typeof(GameObject));
        foreach (var obj in objs)
        {
            //to do
        }


    }
}

猜你喜欢

转载自blog.csdn.net/a13631290405/article/details/80272950