File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 11using System . Collections . Generic ;
22using System . Linq ;
33using UnityEngine ;
4+ #if UNITY_EDITOR
5+ using UnityEditor ;
6+ #endif
47
58namespace ElRaccoone . EntityComponentSystem {
69 /// <summary>
@@ -134,7 +137,13 @@ void OnDrawGizmos () {
134137 // interface.
135138 var monoBehaviours = FindObjectsOfType < MonoBehaviour > ( ) ;
136139 var entities = monoBehaviours . OfType < IEntityComponent > ( ) ;
137- OnDrawEditorGizmos ( entities . ToArray ( ) ) ;
140+ var visibleEntities = entities . Where ( entity => {
141+ var monoBehaviour = entity as MonoBehaviour ;
142+ return monoBehaviour . enabled
143+ && monoBehaviour . gameObject . activeInHierarchy
144+ && ! SceneVisibilityManager . instance . IsHidden ( monoBehaviour . gameObject ) ;
145+ } ) ;
146+ OnDrawEditorGizmos ( visibleEntities . ToArray ( ) ) ;
138147 return ;
139148 }
140149 // Invoking draw gizmos method on each system and service.
You can’t perform that action at this time.
0 commit comments