Can you double check the numbers?
https://playcanvas.com/editor/scene/916873
https://playcanvas.com/editor/scene/916876
https://playcanvas.com/editor/scene/916970
Hello! Is there also a console error?
Hello,
I don`t see console mistakesā¦=(
Do you already know what exactly is ānot foundā?
I think it cant find the scenes, because I see this report after clicking on buttons, but I`m not sure exactlyā¦
Do you have a project link?
Great news, I will try to reboot my laptopā¦
Sorry it was the example project. Do you have a project link? Maybe I can see a mistakeā¦
Yes, ofcourse:
https://playcanvas.com/editor/scene/916895
Pls let me know what do you think about it, I`m very new in it.
I also donāt have a lot of experience, but I can always help to find out where things go wrong.
Are you sure this code is oke:
this.loadScene (this.sceneId, function () {
// Once the new scene has been loaded, destroy the old one
oldHierarchy.destroy ();
});
I canāt find where you set this.sceneId.
Try to change this:
ChangingScenes.prototype.changeScenes = function() {
// Get a reference to the current root object
var oldHierarchy = this.app.root.findByName ('Root');
// Load the new scene. The scene ID is found by loading the scene in the editor and
// taking the number from the URL
// e.g. If the URL when Scene 1 is loaded is: https://playcanvas.com/editor/scene/475211
// The ID is the number on the end (475211)
this.loadScene (this.sceneId, function () {
// Once the new scene has been loaded, destroy the old one
oldHierarchy.destroy ();
});
};
To this:
ChangingScenes.prototype.changeScenes = function(sceneId) {
// Get a reference to the current root object
var oldHierarchy = this.app.root.findByName ('Root');
// Load the new scene. The scene ID is found by loading the scene in the editor and
// taking the number from the URL
// e.g. If the URL when Scene 1 is loaded is: https://playcanvas.com/editor/scene/475211
// The ID is the number on the end (475211)
this.loadScene (sceneId, function () {
// Once the new scene has been loaded, destroy the old one
oldHierarchy.destroy ();
});
};
If you add me to the project I can help better.
Yes, you helped me, it works
But now I figured out that I don`t have abilities to come back to my first page after chosing one scene among those three that I haveā¦
Great!
You need a button or something on every scene to go back to the āscene selectionā scene. I donāt know what kind of game you want to make, so I donāt know what is the best way in your case.
Yes, because of your help I have base, I have some ideas of how to use that to finish my first step.
Thank you, now I have what to study!!!
Sorry about the delay in my response @Ivan_Stratiichuk. My idea would be to have a selection scene in your game, that leads to every other scene. Then, in all the other scenes, you can have a back to selection button. Thatās what I normally do in my games.
Yep, I will add back button folowing the same logic of changing scene code, I will add this code to each scene but all this scenes will gave the same ID number of source scene, so it will back me to scene from which I startedā¦
Hi @Leonidas I am trying to create a PlayCanvas scene that switches between two senes using a button and am trying to open the scene you posted as an example:
https://playcanvas.com/editor/scene/916857
However, it is not opening. Thanks ahead for any help.
Hi @Ian_Curtis,
The way I set this up is by having a scene manager that transports itself between scenes. To ensure that it only gets loaded once, I made an initialization scene that loads the first scene of my choosing and then uses app events fired by the buttons to change scenes from there.
Check out :
https://playcanvas.com/project/756176/overview/scene-manager
To see it at work.