Is BeginPlay supposed to be called on save loading?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
phantombeta
Posts: 2084
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Is BeginPlay supposed to be called on save loading?

Post by phantombeta »

I've noticed BeginPlay gets called when the engine is deserializing the classes, before the serializer can set anything on the class.
This somewhat breaks my mod, so I'm wondering if this is actually intended or a bug. I assume it's the latter, since it doesn't make much sense for this to be happening.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Is BeginPlay supposed to be called on save loading?

Post by Graf Zahl »

BeginPlay gets called for the actors spawned when the map starts, but not for the actors being created when deserializing (They are just empty blocks of memory before the save data gets read back in.) And that cannot be changed because the code has no idea what the spawned data is needed for. You cannot use BeginPlay for any data that doesn't go into the savegame.
Post Reply

Return to “Scripting”