Is there a way to invert Input.mousePosition.y (Java)?

I’m having a problem:
I need a box to follow the mouse, but if I move mouse up the box goes down and then I move the mouse down it goes up.

Simple multiply it with -1

You don’t need to invert it, just use the appropriate function, which in this case I assume is Event.current.mousePosition rather than Input.mousePosition. (P.S. Unity does not use Java.)

–Eric

It’ll put the box outside of the screen.

It’ll spam me a nullreference

NullReferenceException: Object reference not set to an instance of an object
Dungeons.Update () (at Assets/__GData/Scripts/Interactions/Dungeons.js:13)

the line says

windowRect.x = Event.current.mousePosition.x;

Event.current.mousePosition must be in OnGUI.

–Eric

Thanks, it works fine now :slight_smile: