[SOLVED] Scene Changing Does Not Work When Game Is Published

Hi,

I am done developing my game and I would like to publish it. My game includes scene changing, which works fine when launched from the editor, but when it is published as a build, the game does not change scenes. I’m using the same code as found in the scene changing tutorial. Please help, since I need to publish the game ASAP.

Is this an exported build? Or being hosted by PlayCanvas?
Are you getting any errors in the browser console?

This build is being published on playcanvas.com. There are no errors in the console, but it just does not change scenes.

Do you have a link to the project?

https://playcanv.as/b/NySn06i2/ - Published link that does not work.

https://playcanvas.com/project/587794/overview/space-escape-final - project page

https://launch.playcanvas.com/668981?debug=true - Launch link that is playable

The game only works on PC/Mac/Linux, not mobile devices

Will I also be able to publish it on a third party site by downloading the game files?

When I try to load the scenes, there are errors in the console:

My guess is that you may have not ticked all scenes you want included in the game on the build page (if it’s all, tick Select All).

1 Like

Thanks a lot for the valuable help. There’s just one more thing. If you look at the scenes in my project, there is a scene called space shooter and a scene called spaceship found. The space shooter works perfectly fine by itself. However, if you parse the scene id of the spaceship found scene to “space shooter” 's scene id and then launch the game, and press “E”, the space shooter scene malfunctions. The spaceship keeps moving in a certain way despite keyboard inputs. This happens only while changing scenes to space shooter and not when it’s run by itself. Could you please help me out there as well?

Sorry, that sounds like a potentially large problem to debug.

My first thoughts are that when you load a scene, certain scene settings are not applied. This may also mean settings like gravity may need to manually changed in code.

I think I might know what the issue is. Can you just tell me how to set gravity to zero manually in the code?

Maybe you can you try this? https://developer.playcanvas.com/en/api/pc.RigidBodyComponentSystem.html#setGravity

Thanks a lot @jscratsman, this really helped