What your looking for is to edit the Class Default Object. And to be perfectly honest it’s anything but simple there is a few references to how to do it. And I’d recommend looking then up. You can get it to work but it’s quirky in editor at best. In game it seems to work just like you’d expect.
But in editor you have to manually work with the construction script to make things works like what your describing. The construction script is where the objects are stored to be created by the system during construction. We have weapon hardpoints on our characters that each child blueprint can edit to hold a default set of weapons. To handle this in editor we edotntje construction script to add the weapons dynamically. When a weapon is added, we have to manually call for a script update or they don’t show up until you close the blueprint and reopen it.
It’s worth it once you get it working but it is an area that needs a lot of improvement or at least better documentation about CDO and ConstructionScripts for C++.
No. The construction script in c++ is an tree attached to the CDO for that class. It holds descriptions of the subobjects to be created during construction. They are using the term in two different ways. In c++ it’s the tree object. On blueprints it’s working during the actual construction.
In the end we took apart the bp editor and traced everything back to the CDO in code. I’m not at my system or I’d send you the code to actually add a dynamic component.
Another method that was far more tolerant for us in the end was to create a custom details panel that listed the added weapons and provided the interface for the weapon placement without them showing in the component panel at all. It was much easier to put in place and still allowed us to use OnConstruction like normal expectations by looping through the stored data and creating the components when the script ran. But they don’t show in the components panel and we didn’t use transform widget which may be a problem for you.
I know this is an old reply, but if you are still around, is the custom details panel code something you can share? Or at least a snippet? I haven’t tried such a “heavy” customization before but this already sounds exactly like what I could use. In our system we create lots of components dynamically and attach them to various actors. It is frustrating not being able to see or interact with these components in the editor details.