Hi guys, I am loading scenes like this in the engine:
loadScene() {
console.log('Load Scene');
const app = this.$pc.Application.getApplication();
app.preload = true;
app.loadScene(
settings.SCENE_PATH,
function(err, scene) {
if (!err) {
// Scene loaded successfully
console.log('Scene loaded.');
// Hide Spash screen
app.fire('preload:end');
// Process the scene
this.processScene(scene);
} else {
// Error
console.log('Error: ', err);
}
}.bind(this)
);
},
Is there an event that detects that a script component is needed, so that I can load the script manually
at runtime either from local file system or remote?
That warning is being fired from here, when the script component is trying to create an instance of a script type but that type isn’t available. There isn’t an event fired for you to listen to, you could try submitting a feature request in the engine repo about it for the team to review:
Yes exactly. I am using Vue.js as framework. Scripts are stored in a separate folder/file.
I use a Editor exported scene.json to play with.
It works all in all in my setup, but I want also load the scripts on runtime not via Mixins which I have to define in advance, so to avoid declaration in the json and my own one
Adding it to document.head
So I transformed the scripts to Vue Mixins that way I can use the Webpack ecosystem to import them into a Vue component.
Dont get me wrong it is working already but I need a way to get the scripts inside a scene.json.
So I will load the scene data with axios look if are scripts in there and then add the mixins then load the scene into Registry
Scripts so my mind belong to game logic and for me should not be so present in public folder,
this is other when maybe you have a viewer app. Even though I know that there is less chance to obfuscate Js files. Maybe I will use something like NUXT for serverside rendering of JS and Canvas, but this will be another challenge For now yes all scripts are stored at the Vue side and I will decide which script should be used.