Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question IPointerEnterHandler works in the Editor but not in the build (Unity 2022.3)

Discussion in 'Getting Started' started by LukeLeslieFarrer, Apr 30, 2024.

  1. LukeLeslieFarrer

    LukeLeslieFarrer

    Joined:
    Mar 19, 2021
    Posts:
    1
    Good morning

    Having seen numerous issues about IPointerEnterHandler in the forums, I am posting this as none of them seem to be helping.

    We are designing a VR App on the Quest 2/3 using Unity 2022.3.25f1 and an OVRCameraRig.

    It uses an Event System, VRInput and a Physics Raycaster. The object I am hovering over is a Quad (Mesh) and uses a Box Collider.

    In Unity 2019, everything worked correctly, both in the Editor and in the build (apk): as soon as I floated the laser pointer over the object, it expanded.

    public class Blob: MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerDownHandler, IPointerUpHandler , IPointerClickHandler
    {
    ...
    ...
    public void OnPointerEnter(PointerEventData eventData)
    {
    transform.DOScale(....);
    }
    }

    However, in Unity 2022.3, it only works correctly in the Editor. In the Build the laser pointer is able to detect the object (the laser shortens so the collider must be working), but OnPointerEnter is not called and so the object does not expand.

    A workaround is to pause the game by clicking on the Oculus button, then selecting "Resume". It works after that.

    Is there a way I can get the desired behavior without having to right click and resume first?

    Thank you

    Luke