- Home /
Raycasting and GUI
Hey guys, So I'm making a city builder at the moment using raycasting a gui elements.
To keep this simple, I have a barracks building, when the player clicks the barracks, a gui button appears that spawns a soldier when clicked, however, I have coded it so that when the player clicks away from the barracks (i.e. on the ground) it clears this button.
So right now I have an issue where when I click on the "Train Soldier" button, I'm actually clicking out of the barracks, and not pressing the button.
Any ideas on how to bypass this?
Your answer
![](https://koobas.hobune.stream/wayback/20220613160121im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Is there anyway to fade in/out a GUI image without using an addon/asset? 2 Answers
Distribute terrain in zones 3 Answers
How to make a Cube act as a button to increment a number on a screen overlay panel in an FPS? 1 Answer
Any idea why my int wont display on GUI 1 Answer
Make HUD to show object direction 0 Answers