code: @Override
      public void bindScriptBundle(final IScriptBundle scriptBundle, final GVRMain gvrMain, boolean bindToMainScene)
              throws IOException, GVRScriptException {
          // Here, bind to all targets except SCENE_OBJECTS. Scene objects are bound when scene is set.
          bindHelper((GVRScriptBundle)scriptBundle, null, BIND_MASK_GVRSCRIPT | BIND_MASK_GVRACTIVITY);
  
          if (bindToMainScene) {
              final IScriptEvents bindToSceneListener = new GVREventListeners.ScriptEvents() {
                  GVRScene mainScene = null;
  
                  @Override
                  public void onInit(GVRContext gvrContext) throws Throwable {
                      mainScene = gvrContext.getMainScene();
                  }
  
                  @Override
                  public void onAfterInit() {
                      try {
                          bindScriptBundleToScene((GVRScriptBundle)scriptBundle, mainScene);
                      } catch (IOException e) {
                          mGvrContext.logError(e.getMessage(), this);
                      } catch (GVRScriptException e) {
                          mGvrContext.logError(e.getMessage(), this);
                      } finally {
                          // Remove the listener itself
                          gvrMain.getEventReceiver().removeListener(this);
                      }
                  }
              };
  
              // Add listener to bind to main scene when event "onAfterInit" is received
              gvrMain.getEventReceiver().addListener(bindToSceneListener);
          }
      }
docs: Binds a script bundle to a {@link GVRScene} object.
  
  @param scriptBundle
  The script bundle.
  @param gvrMain
  The {@link GVRMain} to bind to.
  @param bindToMainScene
  If {@code true}, also bind it to the main scene on the event {@link GVRMain#onAfterInit}.
  @throws IOException if script bundle file cannot be read.
  @throws GVRScriptException if script processing error occurs.