hey all,
so lets get straight to the point. im trying to make RTS.
i used mouse pick 2d action, to get position of mouse, and then i convert that to world position, and then i create building at that position, when i press mouse down button. that worked just fine.
so now i created action bar in bottom of the screen, few uGui buttons to select different types of buildings.
this scenario works fine:
- user clicks on first button, to select building
- user then clicks somewhere on screen where he wants that building
- building gets placed at that location
now problem happens with this scenario:
- user clicks on first button, to select building
- user decides he doesnt want to place down that building
- so, he clicks on second button to select another type of building
- button is pressed, BUT ALSO, building that he firstly selected with button 1, gets placed underneath button 2 because that is where user just clicked
now problem is obviously in step #4, because "mouse pick 2d" action just ignores UI completely, it basically cant see that there is a button being clicked, its raycast just collides with ground, not with UI.
so i need a way for mouse pick 2d action to see that im clicking on UI button, and at that point mouse pick 2d action should not do anything, it shouldnt spawn building, it should just terminate. but right now it is as UI is completely invisible to mouse pick 2d action.