Error when changing scene only when published [Solved]

Hello everyone, in the editor the scene changes fine, but once published the scene doesn’t load.

I made sure to select all scenes because people with similar issues were not selecting all the scenes.

However the problem still persists. If anyone could help I would greatly appreciate it because this is important to having a menu in my game. Here is the link to my project: PlayCanvas | HTML5 Game Engine
Thanks.

Judging from the error message, you are trying to load an editor only asset (the thumbnail) which is why it doesn’t work in a published build.

Assuming it’s an image, get a reference to the asset and use getFileUrl() instead.

https://developer.playcanvas.com/en/api/pc.Asset.html#getFileUrl

I still don’t understand, what causes the asset to only be in the editor? To test I deleted all assets that were disabled and changed the thumbnail. I don’t know how to link an image to the thumbnail. I still get these errors after starting:

And these after pressing the play button, which loads scene hierarchy and scene settings:

Sorry, I didn’t see the error about the loading scene. That’s what I get for reading this on my phone.

This looks like that not all the scenes are included in the build.

When you publish the build, check that all the scenes that you need are ticked for them to be included in the build :slight_smile:

1 Like

I made sure to check all the scenes, and its marked as checked but I still get the error.

I don’t know what could be wrong with it. Does it have to do with Legacy Scripts? Or could it be a bug that shows it as checked but it’s really not? I just keep getting the same errors as before.

As it’s a legacy project, I can’t fork it to see what is really wrong. Being legacy shouldn’t be an issue.

Once you have checked all scenes, did you publish a new build?

If you are still having trouble, can you export the project so I can try to import it and take a close look at it please?

image

Sorry, I can’t export the project, I don’t have an organization account. However I think I found something that might be related.

For the input on settings I checked the box to enable game pads.

However I reload the page and gamepads are unchecked.

This might be the same thing that is happening to the scene. It shows I click the box to enable the scene, but the box really isn’t checked. I don’t know how to fix this, or it might be a bug in the editor.

Have you tried this?

Yes I have. I do that everytime after checking the boxes. It doesn’t change anything.

Honestly, I’m at a lost. Normally I fork the project and have closer look but as it’s legacy, it’s no longer forkable.

Can you export a published build? (are you on the personal account?)

You could also add me with edit rights (username: yaustar)

I sent you Admin rights, I hope you can help

Fixed. I was surprised the existing code work in editor mode as looking at the API, loadSceneHierarchy was expecting a URL. https://developer.playcanvas.com/en/api/pc.Application.html#loadSceneHierarchy

I changed the code from:

onPress: function (event) {
    this.menuBall.destroy();
    this.entity.destroy();
    app.loadSceneHierarchy(723102);
    app.loadSceneSettings(723102);  
},

to:

onPress: function (event) {
    this.menuBall.destroy();
    this.entity.destroy();
    app.loadSceneHierarchy("723102.json");
    app.loadSceneSettings("723102.json");  
},

Test build: https://playcanv.as/b/K63zKs14/

Wow, thank you so much. That’s weird it works in the editor. Anyway thanks for the help!