I put some simple scene changing buttons, it worked while not published, then vanished when i published it, this didn’t happen when i was using unity, please fix.
Hey @jus.co_ding_me_23,
Have you included all the scenes while publishing? Check the chrome dev console for errors, and post them here so we can get a better understanding of the issue.
i included all the scenes
i will send video
Please post the project
i will post it
I did a fork. The scene loading code is incorrect and was only working in Editor by sheer fluke that the scene data URL matches the scene id without a .json
postfix.
I’ve fixed the code in the fork : https://playcanvas.com/editor/scene/1037401
var NextScene = pc.createScript('nextScene');
NextScene.prototype.initialize = function() {
this.entity.element.on('mousedown', this.onPress, this);
this.entity.element.on('touchstart', this.onPress, this);
};
NextScene.prototype.update = function(dt) {
};
NextScene.prototype.onPress = function (event) {
var oldHierarchy = this.app.root.findByName ('Root');
// Get the path to the scene
var scene = this.app.scenes.find('Game_Play');
// Load the scenes entity hierarchy
this.app.scenes.loadSceneHierarchy(scene.url, function (err, parent) {
if (!err) {
oldHierarchy.destroy();
} else {
console.error(err);
}
});
};
sorry for the bad code, i will fix it