Transferring a component from one actor to another?

I’m trying to make an RTS game in space, and I’m organizing my units by individual ships and combined together to make fleets. Fleets would be the actors that actually move around the world, and each ship is a component inside that fleet. Let’s say I want to disband one fleet and put all the ships into another fleet. What do I use to actually transfer a component to another actor? What type of component would the ships be? I’ve tried scenecomponents because of the attach function, and they stick to the other actors but they don’t actually change hands. Am I just doing it wrong? Another possibility is deleting the ship, getting all it’s variables, and rebuilding an identical ship from scratch in the new fleet. This seems messy, though, and I’m not sure what the best way to do that is anyway. Any help?

Hi Creepytacoman,

I’m not aware that you can actually transfer a component. You would need to recreate it on the new actor, passing the required variables to the new fleet, but you are really only adding a new mesh component to the new fleet and passing in some data. It doesn’t have to be messy, maybe create a struct and an interface to pass it. Let me know if that is helpful.

Hi, thanks for the reply! As you said, unreal engine doesn’t really support transferring components, that’s simply not what they’re built for. I posted this somewhere else too and someone suggested to just make the ships their own actors and pass ownership through changing variables. For example each ship has a parent variable and each fleet has a child ships array.

Yes, that would work fine. Although if its an RTS a big limiter there could be too many actors. Although that may be a bottleneck for optimization. If you feel this question is answered, please mark it resolved to assist other devs with a similar issue. Thanks.