function Update () {
if (Input.GetMouseButtonDown(0)) {
BulletNumber–;
}
}
Still pretty new to scripting.
So I put the script into a gameobject, and type the number I need in the BulletNumber variable. Whenever I click my mouse button, I shoot a Sphere, and one is taken off of BulletNumber . Problem is, I don’t know how to tell Unity to disable the Sphere when the BulletNumber reaches 0.
I’m sure you have an if statement that shoots a sphere when the left mouse button is clicked. Just change that to “if the left mouse button is clicked and BulletNumber above zero”.
Since you are pretty new, I do suggest you look into basic programming tutorials as well as intro to unity stuff. There are tons of videos and text examples. If statements are pretty basic and will usually be covered in these areas. Plus, you’ll learn a lot more to go with it!