void Update()
{
//CONTROLLS
if (Input.GetKey(KeyCode.A))
{
dir = 0.5f * TurnSpeed;
}
else if (Input.GetKey(KeyCode.D))
{
dir = -0.5f * TurnSpeed;
}
else
{
dir = 0;
}
//FUEL BOOST
if (Input.GetKey(KeyCode.LeftShift) && boosterFuel > 0)
{
MoveSpeed = BoostSpeed;
boosterFuel -= 1;
}
else
{
MoveSpeed = CurrentdefaultMoveSpeed;
boosterFuel += 1;
}
//SHOOTING CONTROLL
if (Input.GetKey(KeyCode.Mouse0) && Ammo > 0)
{
shootDelayGun1 -= Time.deltaTime;
if (Gun1 == true && shootDelayGun1 <= 0)
{
ShotGun1();
shootDelayGun1 = Gun1shootspeed;
}
}
else
{
shootDelayGun1 = Gun1shootspeed;
}
//Passive Movement
transform.position += transform.right * MoveSpeed * Time.deltaTime;
//Turns
transform.Rotate(0, 0, dir);
}
void ShotGun1()
{
Instantiate(BangVX, transform.position, Quaternion.identity);
Instantiate(BulletGun1);
//This is the Problem right here^^
}
Perhaps because there’s a bug? Here’s how you can find out:
It is time to start debugging!
By debugging you can find out exactly what your program is doing so you can fix it.
Use the above techniques to get the information you need in order to reason about what the problem is.
You can also use Debug.Log(...);
statements to find out if any of your code is even running. Don’t assume it is.
Once you understand what the problem is, you may begin to reason about a solution to the problem.
If you find more detail and you’re still lost…
This is the bare minimum of information to report:
- what you want
- what you tried
- what you expected to happen
- what actually happened, log output, variable values, and especially any errors you see
- links to actual Unity3D documentation you used to cross-check your work (CRITICAL!!!)
The purpose of YOU providing links is to make our job easier, while simultaneously showing us that you actually put effort into the process. If you haven’t put effort into finding the documentation, why should we bother putting effort into replying?