[SOLVED] Published game is all black/not loading

I’ve searched online on how to fix this, but it seems like I’m the only one with this problem so far. I’m not sure if this is caused by my codes or something else - I’m fairly new to PlayCanvas since this project is just one of my class requirements. I need help with my codes if the codes are the culprit as to why my published game is appearing all black/not loading at all :frowning:

(I’ve also checked the console errors but I really don’t know how to fix them yet)

Here’s the link to my game’s editor: PlayCanvas | HTML5 Game Engine
And here’s the link to my published game: EXPLORATION VESSEL: SYLVIA - PLAYCANVAS

Hi @Gabe_wasabi and welcome,

When I am running your published build I get the following error:

image

It seems the game isn’t able to find and load your scene/scenes. Are you sure you’ve included your scenes to your published build when building it?

There are checkboxes there which you can use to select all your required scenes, so they get included in your build.

https://developer.playcanvas.com/en/user-manual/publishing/web/playcanvas-hosting/

Yup :frowning: I’ve tried multiple times using 1) select all, 2) selecting either scene only (I have 2)

To be sure, I published my game again using my main menu scene, and it still does not work. Not sure if the links change, but I’ll include here the link to the newest publish if it’ll help: EXPLORATION VESSEL: SYLVIA - PLAYCANVAS

Hold on, I see that you now get the same error on launch as well (when launcing from the Menu scene):

It’s coming from this script, the element isn’t available the moment you try to access it (maybe try to access it on postInitialize?):

Try fixing that, and try again building.

By the way, which is your scene that you boot from?

If it’s your Main scene, make sure when building to set that as your primary scene:

image

Right now on your build it seems the Menu scene is set as primary (loads first).

I’m so sorry - I’m still very confused as to where I should define ‘on’. Should it be in a different script, or is there a template code for this that I should put within my warningTopremise script? I referred to the PlayCanvas User Manual script anatomy, but I don’t know where to place or execute postInitialize.

Weird thing is, I was already able to publish a different game for my midterm project a few weeks ago. It worked fine and it had no errors. So I reused some of the codes from my midterm game and made sure that I changed everything that needed to be changed.

Link to my midterm game, should you need to check the codes :frowning: (Antebellum West - PLAYCANVAS)

Lastly, my primary scene is the Menu scene.

Yes, here is your error, you try to access the element component of this entity, but this entity doesn’t have one:

Do you really require that script to be there? It seems it should on a button element with Use Input enabled.

1 Like

Ooh. I accidentally placed a script there earlier, but I also added a script on the button right after.

I removed warningTopremise from the screen, and the published game is working now. Thank you so much!

1 Like