Restore Hardware Cursor Outside of Game Viewport

I started looking into options for how to restore the HW cursor outside of the viewport and I’m finding they either don’t work or they interfere with later lectures.
Here’s what I looked into so far:

  1. Camera.main.ScreenToViewportPoint(Input.mousePosition)
    I initially wanted to check if any of the return values are <0 or >1 but it doesn’t reliably work with Update outside of the game view.

  2. Using OnMouseEnter/OnMouseExit but it seems to conflict with what’s in the next lecture, it doesn’t seem practical to define a collider in world space when I need it in screen space, and I just couldn’t get it to work anyway :slight_smile:

It could be that I’m just not thinking straight about this problem. Is this addressed in future lectures? Have folks tried solving this?

Ha! I didn’t have a flickering cursor issue (within the game view) or a bad FPS figure so I ignored some of these threads. Turns out the side effect of the below is you also get your hardware cursor back when you’re outside the game. My FPS also did go up btw.

Privacy & Terms