C++ Components with sub components.
Hiya! I'm trying to make a system for a building game where I can place modular sockets and ports on objects throughout the world. You can imagine this concept as similar to data ports and power ports on a PC, where you have ports of varying types, pin counts, etc that conform to a standard.
My initial idea for doing this was to use scene components that contained all the logic, data, interactions, and graphics for each type of port, and then place them on the user placeable object actors. The main issue I'm running into is that I think I'll need sub-components or something similar to achieve this. I'll need two static meshes, multiple colliders, and perhaps particles and sounds to boot, and that's just my first thoughts so I'm sure I'll need more features as I move on. Is there any way to achieve something like that? I am using C++, but will likely put these port components on blueprint actors as well as C++ actors.
asked Oct 08 '17 at 01:40 AM in C++ Programming
Yes, make scene component. One of features of scene components if fact that it can contain other scene components, this action is called attaching.
Make that Port component and that port component code will attach static mesh component to it self to define there apperance.
Alternatively you can extend from UStaticMeshComponent and just set mesh and add game play code to it, it should display mesh normally and execute that extra code. But first option let developer to modify appearance of components more smoothly as they can attach more components to it themselves in bluepritnt editor
there also option to use Child Actor Component which allows to use any actor which contains components defining there appearance as a component in other actor, this also allows to use port out side of the actor.
Follow this question
Once you sign in you will be able to subscribe for any updates here