[SOLVED] Scripts do not appear in load order

I usually have all of my scripts preloaded so I dont have to manually load them, but I decided to disable preload on all of them just to see what would happen. Of course nothing in my project worked so I turned preload back on for all of them. But after that some scripts simply refuse to load, and they even dont appear in the script loading order. I believe this might be related to a previous glitch I encountered where I would search for a term in the code editor only for the code editor to read like 24 files total. That has not happened for a while but it does sometimes duplicate results. Anyway what do I do about this.

In fact the number of scripts in the load order keeps changing,

It was 347 before this

image

then it went back down to 344

image

then down to 343

image

now its 347 again

image

Also sometimes some scripts work when I have concatenate scripts turned off.

Can someone explain to me what is going on?

BTW the number should be 371

Hey @ALUCARD this seems really strange. Are you able to share a link to your project so we can take a look. DM me if you want to keep it private

Sure. although you should know that I deleted some useless scripts to see if that would fix it (it didnt), so now the total is 315 but only 276 are currently showing up.

https://playcanvas.com/editor/scene/927086

Also most of the scripts have a circle or dot symbol before the text but some of them do not, like the middle on here.

image

But if if I disable preload the circle appears, can you tell me what this means as I dont think its ever explained anywhere what that represents.

I am. Only 276 of the 316 scripts are showing up in the load order. Thats around a 12.66% failure rate for loading scripts, which is insane. And its not like I am just doing something wrong with the scripts, there really isnt any rhyme or reason as to which scripts are loaded and which are not. Take the following for example:

image

image

This script loads perfectly fine, meanwhile:

image

image

This script, which is nearly identical, does not load for whatever reason. The only difference between these scripts is which button is pressed. Literally an inconsequential 1 character difference, yet it doesnt appear in the load order.

I should also mention that I am able to force load all scripts on launch with another script, but that does not allow me to change the load order, and it does not work if concatenate scripts is turned on. Admittedly this is fine for limited testing, but if I need to publish the project or if I need some script to run before another I am kinda screwed.

Do you have any idea what could be causing this? Or is there some way to force a script into the load order?

Some time ago there was a gamebreaking glitch that would not delete a child entity of a parent entity, and this was fixed by entering a command to manually delete it in the console. Perhaps something similar could be done here, as in grabbing the script id or url or something and manually shoving it into the load order via a command.

did you find anything out about the issue?

Yep, there is definitely something strange going on here. I’ve forked your project and can replicate. I’m gonna raise a ticket on Github, are you ok with me linking to a public forked version of your project. It seems to be a good test to replicate the issue.

yeah its fine if it will help in fixing the glitch. I suppose having literally hundreds of varied scripts gives quite a useful sample size.

1 Like

Ok awesome. I’ve added a ticket here if you want to track Unstable Scripts Loading Order · Issue #1185 · playcanvas/editor · GitHub

I noticed that if I change the scripts from asset to before engine and back or enable preload then disable preload thats when the scripts get all wonky.

1 Like

Any update on a potential fix, even if its manual?

Not yet as @Mark_Lundin is on holidays for another week, but he was investigating, and will continue when back.

“holiweek”

Hey @ALUCARD, thanks for being patient on this one. We’ve figured out what was happening here. Just working on a fix now. Will update you once it’s ready

Alrighty then. Just lemmino when it fixed.

This has been fixed now. Let us know if you have any more issues.