I tried that before. It seems to work for initializing the values in C++. The issue is when you want to change the values at runtime instead of only initializing them.
As far as I know, GetDefaultParameters() only gets what you set as the default in the State Tree within the Editor. Meaning if “Health” was initialized as 0.f in the Editor, GetDefaultParameters() will always return “Health” as 0.f. It can’t be used as a value getter for runtime logic.
If it’s only good for initialization, then you might as well just initialize your desired value in the State Tree within the Editor in the first place.
In my previous post, using GetGlobalParameters() returns an FInstancedPropertyBag.Value (which is an FConstStructView) instead of an FInstancedPropertyBag. Maybe there’s a way to construct an FInstancedPropertyBag from only its value, but I can’t be bothered to jump through so many hoops. For now I’m using my AIController to store “global” State Tree variables.
I suppose them being called State Tree “Parameters” and not “Variables” makes it obvious they should be read-only. But it would be nice to have them function as editable variables instead of only being used to pass in asset data.