Jump to content

Loading prefab with flag causes crash in published game


Genebris
 Share

Recommended Posts


Prefab:Load("prefabs/projectiles/arrow.pfb")

Prefab:Load("prefabs/projectiles/arrow.pfb",Map.LoadScripts,Prefab.NoStartCall)

 

First function will load prefab correctly, second one will fail to load it. This will be in the log:

 

Loading prefab "C:/Users/Genebris/Desktop/SotKaal/prefabs/projectiles/arrow.pfb"...

..

Loading prefab "prefabs/projectiles/arrow.pfb" [32]...

Error: Failed to read file "prefabs/projectiles/arrow.pfb".

Error: Failed to load prefab "prefabs/projectiles/arrow.pfb".

 

You can see that second call didn't get a correct file path. This happens ONLY in published game (standalone or launcher). Does NOT matter if you included only used files or not.

It doesn't happen in the editor or if you launch exe in your project folder.

 

I'm not sure if this is the correct use of loading flags, but if it's not, it should at least give the same error in the editor because I spent 40 minutes thinking that my prefab doesn't get included into the build.

Link to comment
Share on other sites

  • 2 weeks later...

I am confused on this. Should not the flag parameter have the two flags added together instead of separated by a comma? If not, then this is different than all other usage of LE commands that have the ability to stack multiple options together for 1 parameter (eg. the style parameter for Window:Create()). Seems like the reason it is failing to load would be because the engine thinks you are setting the fileid parameter for a workshop item with the variable 'Prefab.NoStartCall'.

 

Syntax

  • static Entity* Load(const std::string& path, int flags=Map::LoadScripts, const uint64_t fileid=0)

So it should be:

Prefab:Load("prefabs/projectiles/arrow.pfb", Map.LoadScripts+Prefab.NoStartCall)

 

Edit--But yes, I agree that it needs to give an error regarding this when played from the editor if it cannot find that workshop GUID item.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

I am confused on this. Should not the flag parameter have the two flags added together instead of separated by a comma? If not, then this is different than all other usage of LE commands that have the ability to stack multiple options together for 1 parameter (eg. the style parameter for Window:Create()). Seems like the reason it is failing to load would be because the engine thinks you are setting the fileid parameter for a workshop item with the variable 'Prefab.NoStartCall'.

 

Syntax

  • static Entity* Load(const std::string& path, int flags=Map::LoadScripts, const uint64_t fileid=0)

So it should be:

Prefab:Load("prefabs/projectiles/arrow.pfb", Map.LoadScripts+Prefab.NoStartCall)

 

Edit--But yes, I agree that it needs to give an error regarding this when played from the editor if it cannot find that workshop GUID item.

Yes, those should be added together. The fileID is an old system that is no longer used. I just left the parameter in so old code will still compile.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...