I made a closet with several door can interact. I want each door have the same funciton just with different static mesh. So I made a blueprint with interface. I don’t want to assemble the closet in the scene, So I made a blueprint to assemble the closet, each door is a child actor component. Then comes the problems.
When I use hit component to interact, child actor component doesn’t implement interface, it’s child actor does, to get it’s child actor, I need to cast to child actor componet, but child actor componet is not a primitive component, so I can’t directly use the hit component to cast. Then I create a box collision as trigger for each door, trace the trigger then use hierarchy to get child actor componet. Finally, the door can open, but it’s quite a long way.
Is there any way more efficient and direct?
Although the door can open, there’s further problem. The trigger won’t rotate with the door, since it’s the child of child actor component, not the door mesh. I want the door open one by one, so I did’t use a multi trace. If I want get something in the closet, the trigger will make me fail. Looks like child actor component is not friendly for runtime interact.
What is a better way to combine several blueprints together as a prefeb?