Adding new components based on property change in Editor(Not @ Runtime)
I have been creating a class (Derived from APawn) in C++ that I would like to expose to Blueprints (So Artist/Designers can more easily modify and create assets). Creating a derived Blueprint from the C++ class is easy enough, however I would like some variables and arrays to be populated by changes made when editing the blueprint, also it would be preferable to have new objects and components dynamically added based on said changes.
I've looked into:
Appropriate reference links:
I've gotten partially there (I think), I came across this : Setting Internal actor properties in editor. Which lead me to the following:
These only seem to work when the actor is placed in the level, in addition it only seems to fire once. I created a quick workaround BlueprintCallable UFUNCTION in the C++ class that manually calls RegisterAllComponents(), and attached that to the constructor graph in the Blueprint class editor. This seems to update the arrays correctly for the actor placed in the level.
Header relevant code: //Header
CPP relevant code:
I apologize for the very long-winded explanation, and if more information is needed I will happily provide it. To summarize what i'm asking:
!Note : I have tried using NewObject() & AddComponent() in both the PostRegistertAllComponents() & OnConstruction(), to no avail.
I appreciate the time anyone has taken to read the above!
It's the C++ closest equivalent of the Construction Script for Blueprints. It get's called every time a change happens.
For dragging an object in the world using the transform gizmo, PostEditMoved get's called and OnConstruction get's called only for blueprints that have bRunConstructionScriptOnDrag set to true, but you can overwrite it.
answered Feb 12 '16 at 12:54 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here