- Home /
Reloader Weapon's Bullet?
Hey guys a just made an reloader arms that's not working. I tried to make that when the player collide with the object, the weapon realod a number of bullets back (60) ;x
This is the function that I use:
function OnCollisionEnter (collision: Collision) {
if (collision.gameObject.tag == "Player"){
Weapon.numberofbullets = Weapon.numberofbullets + 60;
Destroy(gameObject);
}
}
NOte: "Weapon" is the name of my weapon's script and "numberofbullets" is a static var in the Weapon script.
Help please
When my Player collide with the object the ammunition is not reloaded and the object is not destroyed ;/
Is the OnCollisionEnter being called? If you are using a character controller, maybe you should be using OnControllerColliderHit().
Your answer
Follow this Question
Related Questions
Add Weapon 0 Answers
[HELP] Rotate Bullet Script 0 Answers
Bullet Hole not inline with sight?(Center of Screen) 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
level loader script wont work 1 Answer