NonStaticObjectFinder.cs 811 B

12345678910111213141516171819202122232425262728293031
  1. using UnityEditor;
  2. using UnityEngine;
  3. using System.Collections.Generic;
  4. public class NonStaticObjectFinder : EditorWindow
  5. {
  6. [MenuItem("Custom/Select Non-Static")]
  7. static void Init()
  8. {
  9. Object[] gameObjects = FindObjectsOfType(typeof(GameObject));
  10. GameObject[] gameObjectArray;
  11. gameObjectArray = new GameObject[gameObjects.Length];
  12. int arrayPointer = 0;
  13. foreach (GameObject gameObject in gameObjects)
  14. {
  15. StaticEditorFlags flags = GameObjectUtility.GetStaticEditorFlags(gameObject);
  16. if ((flags & StaticEditorFlags.LightmapStatic) == 0)
  17. {
  18. gameObjectArray[arrayPointer] = gameObject;
  19. arrayPointer += 1;
  20. }
  21. }
  22. Selection.objects = gameObjectArray;
  23. }
  24. }