Home > other >  C # Unity OnEnable register event problems () function
C # Unity OnEnable register event problems () function

Time:09-25

In the Unity of official VR teaching,
VREyeRaycaster in OnEnable () and OnDisable () function in the
Function of the Input class (EventManager) event registration and cancellation

Private void OnEnable ()
{
M_VrInput. OnClick +=HandleClick;
}
Private void HandleClick ()
{
If (m_CurrentInteractible!=null)
M_CurrentInteractible. Click ();
}

Only then each Update changed m_CurrentInteractible (), has not yet registered a new function,

Real-time Input class how to change the OnClick event registration function?

CodePudding user response:

Can't directly? Similar to the OnClick +=HandleClick
  • Related