File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 11using System . Collections . Generic ;
2+ using System . Linq ;
23using UnityEngine ;
34
45namespace ElRaccoone . EntityComponentSystem {
@@ -126,8 +127,14 @@ void OnDestroy () {
126127 /// </summary>
127128 void OnDrawGizmos ( ) {
128129 if ( ! Application . isPlaying ) {
129- // When the application is not playing, the GUI will not be drawn since
130- // the controller is not initialized at this stage.
130+ // When the application is not playing, the Gizmos will not be drawn
131+ // since the controller is not initialized at this stage, so no systems
132+ // or services are available. Instead, the Gizmos will be drawn on all
133+ // MonoBehaviour components that implement the IEntityComponent
134+ // interface.
135+ var monoBehaviours = FindObjectsOfType < MonoBehaviour > ( ) ;
136+ var entities = monoBehaviours . OfType < IEntityComponent > ( ) ;
137+ OnDrawEditorGizmos ( entities . ToArray ( ) ) ;
131138 return ;
132139 }
133140 // Invoking draw gizmos method on each system and service.
@@ -178,6 +185,11 @@ public virtual void OnUpdate () { }
178185 /// </summary>
179186 public virtual void OnWillDestroy ( ) { }
180187
188+ /// <summary>
189+ /// Method invoked during editor time when the controller is drawing gizmos.
190+ /// </summary>
191+ public virtual void OnDrawEditorGizmos ( IEntityComponent [ ] entities ) { }
192+
181193 /// <summary>
182194 /// Register your systems and services to the controller. This can only be
183195 /// done during 'OnInitialize' cycle.
You can’t perform that action at this time.
0 commit comments