Hello,
When making a State Tree Parameter that is a struct containing an Array<TObjectPtr<“UObject”>> in a StateTree component, when I hit compile the selected inherited data is cleared and set to null.
But this only happens when the State Tree Component was added from C++ “CreateDefaultSubObject”.
On a State Tree Component that I add manually from the blueprint editor there’s no problem (see repro steps screens or repro project zip).
Do you have an idea of what could cause this ?
I attached a sample empty project with a StateTree and 2 blueprints setup the 2 was (one manually in data and the other one being a ASpawnActor with the StateTree added from C++ constructor), hope it makes things clear and easy to reproduce.
Thanks a lot
StateTreeParamPoly.zip(24 MB)
Haven’t found a solution yet so I made a temporary workaround but I’d be happy to know if there’s a way to fix that issue or if anyone has a suggestion ?
Thanks in advance !
This is indeed quite the wrinkle. I believe it is due to different code paths that are triggered when reinstancing from native versus the BP SCS. BP SCS cache their full state when recompiling which includes the parameters for the ST component. The native sub-objects do not get cached and the property bag has mismatched values when attempting to copy. The workaround is adding the ST component in BP or doing the overrides in BeginPlay or another place where they would not be removed when compiling.
I will mention this with the team. I think a fix will likely be more involved than a hotfix which may mean it would not be in a release until 6.0.
-James