Is it possible to add default widgets(for example, a slider, and a button), along with a hierarchy, to a C++ UUserWidget in the same way we can add default components to AActors(along with being able to change the class of these components in the editor.)? I’d like to specify what widgets should exist by default, and their default settings while also allowing them to be changed by the designer.
I assume I could spawn these widgets I need, then build the hierarchy. However if, for example I spawned a slider in C++, will the editor be able to change that slider to another class(that inherits from slider)?
What i typically do is create a userwidget in blueprints, remove the standard panel thats in their and add for example a simple textbox and configure it with the properties i desire. A designer can then re-use that custom textbox in his own widgets to ensure that font / font-size and everything are always the same.
About your question to change the sliders to something else. I don’t think its possible to modify your template class from the editor. its probably possible in the Contruct event by calling a remove from parent on the slider variable and add something else on its position. You could probably make a variable with a custom class in their, if its filled you override the slider with that class. I would recommend to create a separate widget for it though, it would make it quite complicated.