I’vebeen trying to use a simple attach and detach script but it doesn’t want to work.
As you can see in the image, i attach my player to an actor. then when i press space (or in this case my actionmapping) i want it to detach. But it doesn’t. It plays the “hello” print string but it doesn’t detach.
BUT, if i add the delay function, it DOES actually detach after the delay is finished!
Is this a bug or does Unreal not support DetachFromActor with Input events?
I have done it but with all rules ( in AttachToActor and in DetachFromActor) set to world, and it works for me.
This does not work. I repeat, the OP is right. It is a broken feature in 4.20.2
I also have this issue in 4.20.3. Is this bug reported already? If not, I can make a report for that.
… It looks like the detach doesn’t work if it’s called from ConstructionScript. If called from e.g. a function with CallInEditor, it woks ok. I’m trying to reproduce that cleanly now.
It also doesn’t work in 4.19, maybe in the earlier versions too. DetachFromActor doesn’t work when called from ConstructionScript, but works when e.g. called from a function with Call In Editor (button).
… Looks like it’s an UE limitation, I’ve found related issue, with the same suggested workaround here: Get Attached Actors Doesn't Run in Construction Script? - Blueprint - Unreal Engine Forums
Hello, it seems the problem still exists in 4.25.
Generally we use this approach: (for example we want to attach/detach the player to a vehicle)
- Calling AttachToActor in the player BP and supply vehicle BP as parameter.
- Calling DetachFromActor in the same BP with parameter to vehicle BP.
This is not working, although seems only in specific conditions (maybe if the target actor already has attached another actors).
The “opposite” logic fixed the problem for me: I changed detach logic and called DetachFromActor from the vehicle BP with the player actor as parameter.