I am a C# developer and also know C++, now Blueprints are somehow little mysterious to me and I need to ask what’s the overall strategy when using them.
Say I want to create a cockpit of a starship, with several components with a lot of interactivity, for example buttons of all kind, large, small, light emitting, whatever…
In C++ I would now create a base class button with basic functionalities (push, on/off etc.) then create subclasses for the more sophisticated ones.
When creating the cockpit class, this cockpit holds a certain amount of different instances of kind “BP_Button” and derivates, right?
Now how is this done with Blueprints? Is it the same route as in C++ or not? Should I have a BP_Button class and subclasses and use these Blueprints as components of BP_Cockpit then?
Logically, yes, correct. But handling blueprints as children of other blueprints is a real pain in the butt in UE.
I’d advise either just make the cockpit and put the buttons in there, in the level ( not part of a cockpit BP ). Or if you really want to use BP children, then do it with interfaces, because you’ll go nuts with all the casting and not being able to reach variables you should be able to initialize etc…
It’s just my opinion on this, but I think nesting classes works a lot better in C++, than in BP.
It also really depends what you’re going to do. If you really need a cockpit BP, because you’re making 50 spaceships, then maybe you have to.
If you use child actors in your cockpit BP, which is as close as you can get to nesting, I think the best way is interfaces, because it avoids a lot of ugly casting.
You can also get the cockpit to spawn the buttons it needs.