Skip to main content

Hand Bone

  • Initializes the HandBone's state as a consequence of HandBone being added to the HandSkeleton under the identity specified by the parameters of this method
  • Important thing to note is that this method is intended only for a HandSkeleton to call it while the HandBone is being added to one, calling it manually from any other context is going to result in an exception being thrown; therefore you should never call it since the HandSkeleton does that as intended, regardless of the exact type of a HandSkeleton - this isn't an implementation dependent behaviour
void HandleRemovedFromHandSkeleton()
  • This pretty much does the same as previously described method, only under the opposite circumstances and with opposite effects - uninitializes the HandBone after it is removed from the HandSkeleton it was last added to
  • Same rules apply for calling this method, it is done by the HandSkeleton and it should never be done from anywhere else
void NotifyAddedToHandSkeleton()
  • Performs some other minor internal initialization steps and sends out the internal callback on the HandBone that signals to the derived behaviours that the HandBone has been added to a HandSkeleton
  • Again, just like it is with HandleAddedToHandSkeleton method, this is already getting called by the HandSkeleton at appropriate times, calling it from any other context is either going to throw an exception or it will have no effect at all
void NotifyRemovedFromHandSkeleton(HandSkeleton handSkeleton)
  • Like the previous method, but with opposite effects and on opposite circumstances, with the same rules about calling this method applying here as well

Protected methods

virtual void OnAddedToHandSkeleton()
  • Callback method that gets called when the HandBone is added to a HandSkeleton
  • When this method is called, all of the HandBone's properties (HandSkeleton, BoneId, ParentBone etc.) are initialized and safe to use. The HandSkeleton the bone is added to also has its HandBone related state updated at this point as well
virtual void OnRemovedFromHandSkeleton(HandSkeleton handSkeleton)
  • Callback method that is called after the HandBone is removed from the HandSkeleton that is specified by the method parameter
  • When this method is called, the HandBone's properties and all of the HandBone related state in the HandSkeleton is unitialized/reset. Identity of the HandBone, however, remains unchanged since it no longer affects anything, but it may be useful to derived behaviours at this point to know about it. BindPose is unaffected too
virtual void Reset()
  • Unity built-in callback. This method performs an important task - when the bone gets reset in the editor, it reconstructs the HandBone's state and then it makes sure the HandBone reset takes place with all of the appropriate callbacks being sent and handled in both the HandBone and its HandSkeleton, but only if it was added to one. This keeps the state of the scene safe and valid just the same as the Reset method in the HandSkeleton script does
  • With all that stated it should go without saying that base.Reset should be called from overriding methods
virtual void OnValidate()
  • Unity built-in callback. Performs certain initialization steps for the HandBone and ensures its state is valid
  • Always call base.OnValidate from OnValidate override method
virtual void Awake() 
  • Unity built-in callback. Performs certain initialization steps for the HandBone and ensures its state is valid
  • Always call base.Awake from Awake override method