- Home /
mining in the game
how can i make it so that you can mine something in game and then have a certain number of that material but i only want it to show in one screen that you can bring up by pressing a button example: hydrogen----- 32 units oxygen------- 99 units element 0---- 12 units methane ----- 58 units etc etc i want it so that you can only mine it in a certain spot thanks
i don't get it... can you give me a better explenation?
Psudeo from what I can get from it... If player pushed __ key, show GUI. OnGUI has all the stuff that is needed. If player pushes key, disable the GUI... shouldn't be to hard.
Answer by Jason B · Mar 23, 2011 at 06:33 PM
I would really recommend reading the scripting reference in the manual and learning one of the languages Unity uses. The reason I say this is that what you're asking for is as simple as adding to integers and displaying GUI boxes, which is very basic and covered in full (and then some) right in the manual. Since I don't believe you've read the manual, I at least ask you do that before asking others to do the work for you. No offense intended. I'll help you with where to look, though:
Search OnGUI in scripting reference for creating the interface.
For what you asked, you need to learn about strings and integers (and general programming).
You didn't say what language you're trying to use (I'm guessing you don't know yet) or what sort of game you're trying to make, so I don't know what to say about the mining thing. How you go about it will differ on whether you're making an isometric, 3rd person, 1st person, etc. type of game. For a first-person game you might make it based on where you click, for a third person game it might be based on a raycast.
Hopefully you understand why I point you in the right direction rather than writing a script for you; too many people come here asking for script after script, and then they get frustrated later because they can't write scripts themselves, and they subsequently lose interest or feel helpless and quit game making forever.
I'd recommend programming in C# since Microsoft has a very good program with great autocomplete to help you learn quickly (Microsoft Visual Studio C# 2010). Plus I'm pretty sure the majority of our helpers here program in C#, so you'll more quickly get an answer you're looking for (and won't have to translate to a different language).
ok thanks where is this manual that you speak of??
Scripting Reference: http://unity3d.com/support/documentation/ScriptReference/index.html
$$anonymous$$anual: http://unity3d.com/support/documentation/Components/index.html
Your answer
![](https://koobas.hobune.stream/wayback/20220613114342im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to make a drivable car in unity3d with scripts 2 Answers
How do I make a round minimap? 2 Answers
How to Activate Random GameObjects? (C#) 1 Answer
Engine Belt 2 Answers
Has anyone used MeshChartFree? 0 Answers