Added bonus RNG damage does not reset on enter/exit

Hi Slav,

You are on the right track but there is a big problem with Unity that you probably do not know yet. When you change a prefab, the changes persist. For this reason, do not override the values of a prefab at runtime.

First of all, edit the prefab while the game is not running. Set the attack variable back to your initial value.

Then save the attack data for the tower(s) in your tower spawner. A new variable helps. Initialise that variable with the initial value of your prefab. Use that value for the spawned towers. If you implemented more ideas, a new class for the tower configuration at runtime might be a solution. However, if you have just one tower, a simple variable in the tower spawner is sufficient.

Did this help? :slight_smile:


See also: