Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Jul 16, 2013 at 08:05 AM by AlucardJay for the following reason:

Duplicate Question

avatar image
-1
Question by ReflexGames · Jul 15, 2013 at 09:59 PM · javascriptfpsgunammo

ammo display javascript

i need a ammo display script, so when i shoot the gun, the ammo in the bottom left shows how much bullets i have left.

example:

23/30

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image reptilebeats · Jul 15, 2013 at 10:01 PM 0
Share

you may want to have a look at some tutorials on scripting to get this

avatar image clunk47 · Jul 16, 2013 at 04:06 AM 0
Share

You shouldn't come here and just ask for scripts from people if you are serious at all about making a game. Google it first "Unity ammo display on gui" and you will find all kinds of examples.

avatar image ReflexGames · Jul 16, 2013 at 05:09 AM 0
Share

Ya, we'll I'm 13 clunk47, so I think I'm doing pretty good. You are probably way better then me. And this is called unity answers.

avatar image clunk47 · Jul 16, 2013 at 06:59 PM 0
Share

Yes sir. It IS called Unity Answers, not Unity Script Repository. Don't get too upset. Have a look at the Unity $$anonymous$$anual and the Unity Script Reference. If you really want to get into this, As @reptilebeats explains, have a look at some Tutorials provided by Unity. These should lead you in the right direction. There is a tutorial there called "GUI Essentials" that will get you really going with GUI code. Here are some demo projects you could download and skim through as well.

avatar image ReflexGames · Jul 17, 2013 at 01:21 AM 0
Share

Sorry for kinda freaking out... :(

1 Reply

  • Sort: 
avatar image
2

Answer by Android Matt · Jul 15, 2013 at 10:51 PM

You will need two variables, one to store your max ammo and one to store the current ammo.

In order to display those you will need to use some form of GUI, e.g:

 var currentAmmo: int = 30;
 var totalAmmo: int = 30;
 
 function OnGUI () {
     GUI.Label (Rect (25, 25, 100, 30), currentAmmo+"/"+totalAmmo);
 }

I agre with reptilebeats, tutorials would be a good place to start. There are plenty that can be found with quick Google.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Gun Firing help? 2 Answers

How to let my gun shoot ?? 0 Answers

musket gun script is not working 3 Answers

Some issues with weapon switching and reloading? 2 Answers

crosshair scrip not working 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges