The rules for delta serialization in UE4 are complicated, and the editor tries to hide them from you, which works 90% of the time but can lead to confusion and data loss in other situations. In the repro above, there is a parent blueprint with a single variable struct, and an array of the same struct (FEngineTestNativeSubStruct). The child blueprint modifies a single variable inside both the single struct and the first array struct. But when the child blueprint is saved, it only saves out the modified variable in the single struct, but saves the entire array including values that are the same as the parent. This means the single struct still mostly inherits changes from the parent, but the array is completely disconnected from any changes the parent would get. This causes the behavior seen in step 6, and is a very old engine decision dating back at least 10 years.
To compensate for this, when making changes to arrays inside the parent the editor tries to modify any child blueprints (and actor instances) it knows about, but this only works if they are open. It does not tell the user it is doing this, but does mark the child bps and levels as dirty. In the UI the behavior looks identical between arrays and single structs, but because of the delta save behavior this is a lie. This leads to very confusing behavior for end users when they modify arrays inside parent blueprints, as changes appear to work most of the time, but will randomly fail. Maps and static arrays work like single structs, this is only an issue with TArray properties.
There are several possible fixes, one is to change it so TArrays do delta serialization like everything else in the engine, this would be the cleanest fix but could theoretically cause problems the opposite direction. Another option is to try and load the child BPs/instances, but this would be very expensive. A third option is to add some sort of notification or indication this is happening, such as a ! tooltip on array properties that are disconnected from their parents.
Why does the REMOVE method of map container remove elements have memory leaks?
How does TextureRenderTarget2D get TArray<uint8> type data?
UMG RichText not appear image when packaged
How would I go about lerping the rotation instead of it snapping when turning (pls dont sue me epic)
How to delete some elements correctly when deleting an array loop?
What is the cause of the packaging error falling back to 'GameUserSettings' in ue5?
How do I set a material as a post-processing material?
What is the difference between Camera and CineCamera?
How to implement springarm components to scale according to mouse position in spawn?
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-96195 in the post.
25 |
Component | UE - Foundation - Core |
---|---|
Affects Versions | 4.26 |
Created | Jul 30, 2020 |
---|---|
Updated | Oct 9, 2024 |