UBlueprint’s uproperty member with the type FInstancedStruct can not be saved into CachedPropertyData. Is there any way to solve this problem?
Steps to Reproduce
1.. create a UClass with FInstancedStruct as its uproperty member;
2.. set the meta class for this member;
UCLASS(BlueprintType, Blueprintable)
class UCueCombineNiagaraComponent : public UActorComponent
{
public:
UPROPERTY(EditDefaultsOnly, meta=(BaseStruct=“/Script/CueTransformInfo_CueActorSpace”))
FInstancedStruct NiagaraTransformConfig;
}
3. Cook this blueprint;
4.You will find that, in the function BuildComponentInstancingData, the UClass can only get the original type of NiagaraTransformConfig(FinstancedStruct)
[Image Removed]
5.Then, RecursivePropertyGather will skip to add NiagaraTransformConfig( which type is always FInstancedStruct ) into ChangedPropertyList even though we have changed the value ofNiagaraTransformConfig using unrealeditor.
[Image Removed]
Hi,
It looks like this should be resolved in CL# 47597728, that fix will go into the eventual 5.8 release but you could try backporting it to see if it works for you. Let me know if you run into any problems.
Best,
Cody
Hi, Albert
After applying this commit to my code, NiagaraTransformConfig is exactly added into ChangedPropertyList. But there is still another problem when we add an UProperty as a class member.
For example, we create a UStruct CueTransformInfo_CueActorSpace with an UProperty member int size;
UStruct(BlueprintType)
struct FCueTransformInfo_CueActorSpace
{
public:
UPROPERTY()
int size;
}
UCLASS(BlueprintType)
class UCueCombineNiagaraComponent : public UActorComponent
{
public:
UPROPERTY(EditDefaultsOnly, meta=(BaseStruct=“/Script/CueTransformInfo_CueActorSpace”))
FInstancedStruct NiagaraTransformConfig;
}
Then we create a BP Package with the component UCueCombineNiagaraComponent*, and* change the value of size to 1 in UnrealEditor.
When cooking this BP Pacakge, the component’s member NiagaraTransformConfig will be added into ChangedPropertyList, but CueTransformInfo_CueActorSpace’s member size will not be added.
And when spawning actors with the UCueCombineNiagaraComponent ,and serializing the NiagaraTransformConfig , only the default value of CueTransformInfo_CueActorSpace will get serialization, that is, size’s value is set to zero**.**
Hi,
I did a bit of testing and found the same result, it looks like the native comparison lets us cache the struct itself but we’ve already missed the chance to add the child uproperties. I’ve filed a bug report (UE-354431) to investigate further, we’ll see if we can get a fix for this into 5.8.
Best,
Cody
Hi Albert,
Thank you for looking into this and sharing the findings. I really appreciate the effort and the detailed update. I’m glad to hear that a bug report has been filed, and I’ll be looking forward to the fix hopefully making its way into 5.8.
Hi there!
In addition to CL# 47597728 you will also need to grab CL# 46175874. That should resolve the additional issue you’ve reported here. The technical side of this is that all instanced structs should now serialize the complete value to the cached template data that’s used for dynamic spawns at runtime when the optional fast path is enabled on the outer actor.
Both fixes will be included in the next release (5.8).
Hope this helps! -phil.
Hi Kavan,
Thank you for the update! I appreciate you pointing out CL# 46175874 in addition to CL# 47597728. I applied the changes, and I’m happy to report that this submission has effectively resolved the issues I was experiencing.