Source: world/unity-world.js

import {World}  from './world.js';
import {VRSPACEUI}  from '../ui/vrspace-ui.js';

/**
Use in conjunction with babylon.js unity exporter.
After the scene loads, create UnityWorld with engine, title and scene as arguments,
then pass it as argument to WorldManager constructor.
Most of world methods do not make sense in this class: scene creation and loading related ones are never called,
as this is all done in script generated by exporter.
Practically the only useful method is entered(), possibly XR support.
Another option is to completely replace generated code, and call BABYLON.SceneManager.LoadScene
as generated code does in executeSceneLoader function.
 */
export class UnityWorld extends World {
  async init(engine, name, scene, callback, baseUrl, file) {
    this.engine = engine;
    if ( name ) {
      this.name = name;
    }
    this.scene = scene;
    VRSPACEUI.init(scene);
    try {
      this.canvas = engine.getInputElement();
    } catch ( exception ) {
      // using old version of babylon
      console.log("WARNING: using old version of babylon.js");
    }
  }
}