Awake to change execution order to prevent dead enemies coming back to life

Hi I had a bug that caused dead enemies to come back to sometimes come back to life with full hp for their level upon loading.

I realized that this was due to the execution order and the restore value was being called before the Health.cs start so the health was being restored after load.

If you experience the same change it to awake:

   private void Awake()
        {
            _baseStats = GetComponent<BaseStats>();
            _healthPoints = _baseStats.GetStat(Stat.Health);
        }
2 Likes

Race conditions, they are fantastic!

1 Like

Privacy & Terms