i already asked this but i didnt get any answer and i really need this to be working, so here it is a little more detailed, i have a weapon system where i change between them by pressing the numbers bar(on top of the keyboard) the weapons are instantiated, so everytime i a press a number, it instantiates a new clone of the prefab. how can a i make the guns keep the bullets when i change the current gun instead of get fully charged everytime?
excuse my english
for (int i = 0; 0 < guns.Length; i ++)
{
if(Input.GetKeyDown((i + 1) + "") || Input.GetKeyDown("[" + (i + 1) + "]"))
{
EquipGun(i);
break;
}
}
}
void EquipGun(int i) {
if (currentGun) {
Destroy(currentGun.gameObject);
}
currentGun = Instantiate(guns*,handHold.position,handHold.rotation) as Gun;*
-
currentGun.transform.parent = handHold;*
-
currentGun.gui = gui;*
-
animator.SetFloat("Weapon ID",currentGun.gunID);*
- }*