@@ -23,23 +23,24 @@ public class EcsactRunner : MonoBehaviour {
2323 private Ecsact . Details . ExecutionEntityCallbacks entityCallbacks = new ( ) ;
2424
2525 void Start ( ) {
26- Ecsact . Defaults . Runtime . OnEntityCreated ( ( entityId , placeholderId ) => {
27- EcsactRuntime . EntityIdCallback callback ;
28-
29- var hasCallback =
30- entityCallbacks . GetAndClearCallback ( placeholderId , out callback ) ;
31- if ( hasCallback ) {
32- callback ( entityId ) ;
33- }
26+ Ecsact . Defaults . WhenReady ( ( ) => {
27+ Ecsact . Defaults . Runtime . OnEntityCreated ( ( entityId , placeholderId ) => {
28+ EcsactRuntime . EntityIdCallback callback ;
29+
30+ var hasCallback =
31+ entityCallbacks . GetAndClearCallback ( placeholderId , out callback ) ;
32+ if ( hasCallback ) {
33+ callback ( entityId ) ;
34+ }
35+ } ) ;
3436 } ) ;
3537 }
3638
3739 public Ecsact . ExecutionOptions executionOptions = new ( ) ;
3840
3941 internal static EcsactRunner CreateInstance < ComponentT > (
40- EcsactRuntimeDefaultRegistry . RunnerType runnerType ,
41- EcsactRuntimeSettings settings ,
42- string name
42+ EcsactRuntimeSettings settings ,
43+ string name
4344 )
4445 where ComponentT : EcsactRunner {
4546 var gameObjectName = name ;
@@ -68,7 +69,6 @@ protected void Execute() {
6869 try {
6970 executionOptions = new ( ) ;
7071 LoadEntityCallbacks ( localExecutionOptions ) ;
71- // NOTE: Temporary, this should be abstracted out
7272 localExecutionOptions . executionOptions . createEntities =
7373 localExecutionOptions . create_entities_placeholders . ToArray ( ) ;
7474 Ecsact . Defaults . Registry . ExecuteSystems ( localExecutionOptions ) ;
@@ -89,7 +89,6 @@ protected void LoadEntityCallbacks(ExecutionOptions localExecutionOptions) {
8989 for ( int i = 0 ; i < localExecutionOptions . create_entities . Count ; i ++ ) {
9090 var builder = localExecutionOptions . create_entities [ i ] ;
9191 var id = entityCallbacks . AddCallback ( builder . callback ) ;
92- // NOTE: Temporary, this should be abstracted out
9392 localExecutionOptions . create_entities_placeholders . Add ( id ) ;
9493 }
9594 }
0 commit comments