Attaching and detaching blueprint actor to blueprint actor

Hello :wave:

I am new to these forums, and this is my first Unreal project. I am stuck on this issue of attaching, detaching, and reattaching one blueprint to another.

My project is an escape room, and I need to have a backpack with a lock on it. The backpack and lock should move together. If the lock is selected, it detaches and flies to the player for inspection. Then it needs to fly back to the backpack and reattach.

The backpack and lock are both blueprints. I successfully attached the lock to the backpack with a Child Actor component, and I can use Detach From Actor to remove the lock from the backpack and fly it to the player. But how do I reattach it to the backpack??

I have tried reattaching with “Attach Actor to Actor”, and with “Set Owner”, but neither work. The lock doesn’t move with the backpack afterward. (FYI: The backpack is a physics actor).

Thanks in advance for any help!

Hello!

there is 2 reasons I can think of where an attach could fail:

  • you try to attach a static object to a movable object
  • the 2 objects you try to attach together don’t belong to the same sublevel
    But you should have an error in the logs, is that the case?

If not, are you sure they are not attached? You fly back the lock to the backpack, that mean you temporarily control the lock’s transform. Are you sur this code is stopped once the lock is back in place? If not the attach could have worked but if you’re still updating the actor’s transform it will look like the attach failed

Hi and thanks so much for writing back!

I am making sure the lock is a moveable object (at least I think I am - using the root component)

The two objects are both blueprints, but that seems to be the problem. I have only attached blueprints before using Child Actors.

Here’s a Drive link with some screenshots and a video in case that helps.

https://drive.google.com/drive/folders/12l0zDvqpJ2r0u6_RBBsPlfOLVzaXwQN3?usp=drive_link

Thanks for the link.
You mentioned the backpack has physics simulation enabled, but I see that in your Pl_Backpack blueprint, backpack_Cube_2 which is your simulated mesh is not the root component of the blueprint. That means that the backpack mesh will move but it won’t affect the transform of your actor.
If you attach the lock back to the actor, it will be attached to the root component of your blueprint (DefaultSceneRoot). So your attach is probably successful but technically the actor doesn’t move, only the backpack mesh does.

To fix that, you can either:

  • use “Attach Actor To Component” and use backpack_Cube_2 as the parent
  • or in your Pl_Backpack blueprint set backpack_Cube_2 as the root component so the physics simulation can move your actor

Hi Dlingr,

Setting backpack_Cube_2 as the root component worked perfectly! Thank you SO much :smiley: :smiley: :smiley:

Glad I could help :slightly_smiling_face:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.