What is runtime serialization in the first place?

From this doc article, it looks like it is describing some optional functionality of the behavior package, and I am under the impression that if I don’t need to save and load states between sessions then I don’t need runtime serialization at all. Also from the doc it looks like the attributes[Serializable, Unity.Properties.GeneratePropertyBag] and [assembly:GeneratePropertyBagsForAssembly] are to impelement/enable this optional feature.

However, when I create a node (action) from the graph editor UI, the attributes are by default there, plus I may have had stuff broken when I tried to remove the attributes from some of my action classes (not sure if this is the cause), and I was only able to recover by deleting and remaking a graph.

I am leaving all these attributes in for now, but I want to know what do they do exactly.

Hi cz-ds,

Those attributes are for runtime serialization, so for saving & loading graphs at runtime.
This is an optional feature, you are correct.

I would recommend just leaving in the attributes that are generated for now as you could cause compiler issues removing them.

The Serializable attribute may also be in use for for other features & not only the runtime serialization.

Right now we are generating property bag code using these attributes automatically for you. That’s also why the classes have to be partial at the moment.

I will bring this up with the team & see if in the future we can allow you to disable this feature completely when not needed.

If you want to fully understand what runtime serialization is doing you can look at the Runtime Serialization package here:

1 Like