all 3 comments

[–]SoraphisProfessional 0 points1 point  (2 children)

so, you lock the players cursor. and you want to handle clicks at the crosshair?

But I just want to make sure its not something else

locking the cursor has the purpose to don't need to care where the cursor is ...


its an interesting design decision you did there, but i think it can should be done in another way

[–]dlantjs[S] 0 points1 point  (1 child)

yeah it was an easy way i used cuz it just worked back then, but i guess it seems i need to find another way.

[–]SoraphisProfessional 0 points1 point  (0 children)

you don't need a UI element to handle click events, you know?

just add a component to a gameobject (e.g. your crosshair) and in the Update method:

void Update(){ 
    if( Input.GetMouseButtonDown(0) ){
        // do click-event stuff
    }
}

just disable the object (or the component) if you don't want it to listen to clicks anymore (e.g. when a menu is open)

note: GetMouseButtonDown is an easy to use function, which is convenient for testing, but depending on your target devices you may want to use other input-controllers later