Okay so I was curious after reading this article as to what detach() does, it sounded like it is called for actors that an actor owns but this doesnt seem to be the case after some testing. The text is alittle hard to follow but I dont think this is a problem with the writing so much in that every subclass of actor is refereed to as an actor so it gets confusing. For the sake of examples I might suggest using 2 different actor names so you can tell which is which where priority matters, like in the case of an actor and an actor which has that actor as an owner (probably didnt follow that right?) so ActorOne, ActorTwo has an owner=ActorOne. I'll look into base changed to see how that gets called during destroy also.
My test, I had 1 actor (subclass of Info called UT_MDI_Pawn) which gets attached to a UTPawn and checks for a certain inventory item, now when the UTPawn is destroyed no Detach is called for UT_MDI_Pawn. Maybe I am mistaken by readin this on whats supposed to happen. I'll test Basechange and see if I cant help clarify this alittle to make sure no one is mistaken cool --00zX 10:36, 18 March 2010 (UTC)
- The Attach()/Detach() events are in no way related to ownership. In fact, an actor can be attached to one player, but owned by a completely different player. (Think sticky grenades!) For your example, ActorOne is considered attached to ActorTwo if
ActorOne.Base == ActorTwo
. In UT2004 this can be achieved throughActorOne.SetBase(ActorTwo)
or ActorTwo.AttachToBone(ActorOne, 'BoneName'). I think in UE3 AttachToBone() was merged into the SetBase() function, allowing you to specify a SkeletalMeshComponent and bone name. Attaching is a physics thing, so you shouldn't abuse it just for the notification as you will waste processing power on pointless location updates. —Wormbo 11:11, 18 March 2010 (UTC)
-
- Ahh yes I can see why I was getting confused now, I was looking for an event which notified a child when its owner was destroyed so I can destroy it along with it if need be. For obvious reasons I dont want to subclass UTPawn (one of the examples where Im using this method). If that is true for SetBase it is a shame because that would open the required functionality without using the overhead of physics. --00zX 11:25, 18 March 2010 (UTC)
Redirection from Destroy
The "destroy" redirection to this page might be a bit confusing. When I search for the keyword, I am rather interested in what to do to [destroy] something rather than knowing what happens after that. Maybe it should be incorporated into this page. Besides that the old page lacks a detailed explanation with examples of how to free all references, just in case someone doesn't know. ;) --Crusha 14:55, 19 January 2011 (UTC)
- Good point. I've changed the redirection to Actor#Destroy for now. There's not that much to say about how to destroy an actor, right? —Wormbo 17:30, 19 January 2011 (UTC)