You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEditor;
-
- public class MyEditorUtils
- {
- [MenuItem("GameTools/遍历Hierarchy")]
- static void GetAllSceneObjectsWithInactive()
- {
- var allGos = Resources.FindObjectsOfTypeAll(typeof(GameObject));
- var previousSelection = Selection.objects;
- Selection.objects = allGos;
- var selectedTransforms = Selection.GetTransforms(SelectionMode.Editable | SelectionMode.ExcludePrefab);
- Selection.objects = previousSelection;
- foreach (var trans in selectedTransforms)
- {
- if (trans.gameObject.layer == LayerMask.NameToLayer("MiniMap"))
- {
- Debug.Log(trans.name);
- }
- }
- }
- }
|