As a simple example, say I have a project where I’m going to be using a lot of Spotlight components. All of these spotlights need to have the same OuterConeRadius of 20.
In Unity I would be able to set up one light the way I like and save that configuration as a preset. I could then set that preset as the default and every time that component gets created it applies that preset automatically.
How can I achieve the same thing in Unreal?
Drag one spot into the level, and configure it.
To make the subsequent spots, just use ALT-drag to duplicate.
That was merely an example, not the exact or only use case. I don’t want to duplicate the actor that contains the component, I want the component to automatically apply a set configuration when it is added to an actor.
unreal doesnt have prefabs like that.
you can make a component and set whatever default values you want in it. If you wanted multiple configurations just of the values of that component added onto some actors in the level, you could make some data assets that can be swapped out per instance on the actors. Or you could do some stuff in the construction script, like take in an instance editable name and use that to look up data from a data table.
or could just have a few hardcoded values that get switched from an enum in the construction script.
basically, in short, if you want a lot of configurable actors to setup in the level at design time you’ll setup the logic for configuration in the construction script.
The constructor function seems somewhat unreliable.
I have this in my constructor. I compile the bp, then add the box collision component. The box’s collision is OverlapAllDynamic. The component name does print in the output log, but the settings aren’t applied from the ctor.