Advertisement
Pro_Unit

StaticObjectsSelector

May 6th, 2022
1,327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. using System.Linq;
  2. using UnityEditor;
  3. using UnityEngine;
  4. using Object = UnityEngine.Object;
  5.  
  6. namespace Gameplay.Utilities
  7. {
  8.     public class StaticObjectsSelector
  9.     {
  10.         [MenuItem("Static Objects Selector/ContributeGI")]
  11.         private static void SelectContributeGI() =>
  12.             SelectGameObjectsWithFlags(StaticEditorFlags.ContributeGI);
  13.  
  14.         [MenuItem("Static Objects Selector/NavigationStatic")]
  15.         private static void SelectNavigationStatic() =>
  16.             SelectGameObjectsWithFlags(StaticEditorFlags.NavigationStatic);
  17.  
  18.  
  19.         private static void SelectGameObjectsWithFlags(StaticEditorFlags flags) =>
  20.             Selection.objects = Object.FindObjectsOfType<GameObject>()
  21.                 .Where(gameObject => GameObjectUtility.AreStaticEditorFlagsSet(gameObject, flags))
  22.                 .Cast<Object>()
  23.                 .ToArray();
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement