public var ZombiePrefab: GameObject;
ZombiePrefab.GetComponent("ZombieScript").health = health + 10;
I want to change the health of the prefab so that when the next wave of zombies starts they have more health. this code doesn’t work so can anyone tell me how to fix this code or just how to change the value of the variable.
You generally do not want to change prefabs at runtime. For example, if your game gets rebooted, should it keep the variable you set or the one it’s built with?
What I would do instead would be to write a WaveManager script that each zombie would check with when they’re instantiated, and set their own health based on the current wave index.