HUD appearence

Hi! I am almost finishing my first game! ^.^

It’s almost done, and i have just a few things to do, but i want to add one thing to the gameplay. Did you guys played Counter Strike? Remember when the game loads and then a box appear with a description of the map? That’s it, i want to do this.

I want to make a HUD/UI system, that, when you spawn, a box with a text with a description of the map appears and only disappear when you click on CLOSE. How can i do this?

That's not something that happens by itself; any input *Down function runs only once, and can't run again until the button is released. If you ever got multiple calls, that presumably means you had the same script running on multiple objects; nothing to do with Update. Anyway, at the end you say "I know I can use OnMouseDown but I need both left and right clicks". So, this code functions as OnMouseDown, but for both left and right (and middle) clicks, thus answering the question. It's probably better if you use it in your project before continuing the discussion.

2 Answers

2

Well I would suggest that you make the code that disappears the box of text. And for the UI Button: “Close” gameobject, you can add that script in the inspector panel at the bottom where it says on click. So when you click on that “Close” button, the text will disappear. But to be able to add it, the function that contains the disappearing code should be public so it can be seen in the inspector :slight_smile:

Nice! Thank you, i i didn't know it was so easy =]

Learn the new UI system Learn game development w/ Unity | Courses & tutorials in game design, VR, AR, & Real-time 3D | Unity Learn