- Home /
Problem with uvRect.Compare(mouse position in Vector2)
Hello, im trying to implement actual actions in my inventory system(for example clicking on something make something do something) and to admit, i was too ambitious and i wanted to make this all on one script. Now i am regretting it, but anyways i decided to make this by comparing the uvRect of my rawImage thats used for item icon to mouse position and checking if player clicks. Hovewer this did not work. i made two debug Vector2 variables and assigned the icon xMin,yMin and xMax,yMax to them and made them public so i can compare them with my (dirty) mind. But when i turned the game on it turned out that those variables vere horribly wrong, something around 1. The right-upper corner of the icon was actually somewhere around x=50 and y=750. why is this happening? I presume that might have something to do with render layers, which i dont know bit about. Can someone tell me what i am doing wrong,please?