Page 1 of 1

Determine When SceneGraph Has Loaded in a State Controller

PostPosted: Tue Sep 12, 2017 4:26 pm
by rob
If you are using the state router system in IGE 2.x you may notice that the order of initialisation of state modules is:

textures -> controller -> sceneGraph

This means that at the point your controler init is called your sceneGraph data may not exist in the engine scene graph. If you want to be informed when it is there, simply hook the "ready" event from your controller module:

Code: Select all
appCore.module('MyStateControllerModule', function ($ige, $game, IgeStreamComponent) {
   var moduleSelf = this;
   
   var MyStateControllerModule = function () {
      var self = this;
      
      moduleSelf.on('ready', function () {
         // Your sceneGraph data will exist now
      });
   });
});