Search Unity

new input system

Discussion in 'Input System' started by Eck0, Jul 2, 2020.

  1. Eck0

    Eck0

    Joined:
    Jun 6, 2017
    Posts:
    48
    hi i am switching to the new input system i saw that onmouseenter, onmouseexit not function , For this to work, I have to be add PhysicsRaycaster component to the camera and finally implement IPointerEnterHandler, IPointerExitHandler.
    I would like to know if PhysicsRaycaster has a lot of consumption or if there is any other better alternative.
     
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    The overhead here is pretty more or less equivalent. In both cases, there's raycasting into the scene to determine hits.

    Overall, the most performant way is to rely on neither mechanism as both are very general. They raycast over potentially great distances and with rather wide filters. Largely depends on what exactly you're doing but building more restrictive mechanisms and, if possible, avoiding raycasts entirely, is the most performant where. But then, too, like with all performance stuff, the gain here may not matter a bit and not be worth the time spent on it.

    If UI selection works for you and doesn't show up as a problem in the profiler, my recommendation would be to just run with it.