PostInitProperties funcitonality for a USTRUCT
I'm trying to create a new BlueprintType with a USTRUCT. I expect to be able to do the following:
Obviously I cannot use the PostInitProperties function in a struct since it is defined in UObject.
But if I change my struct to a class derived from UObject, I can't edit default values in the BP editor:
In other words, how do I remove the need for a custom initialization function? 99.9% of the time, it will be in this exact spot:
Or look at it this way:
In code alone, I'd just use parameters in the constructor to instantiate unique instances of a class/struct. How do I accomplish this with my C++ class when I am instantiating it in UE Blueprints?
I'd like to use it as a variable in Blueprints, so I don't want to have to create child Blueprint classes of my data class every time I simply need different defaults.
Is something like this possible, a feature request, or against UE4 standards/workflow?
I dont think that possible, default are stored in CBOs Class Defaults Object and struct is stored as a part of a class/object an both defaults and serialization in to the file, when you got PostInitProperties this includes all structs in the class.
You can create custom widget for property editor for your struct, maybe you could try doing something with that and leave constrcutor to do the work on C++ side:
Doing construction nodes is also valid solution but user can still normally make structs with make node
Follow this question
Once you sign in you will be able to subscribe for any updates here