Hi, I have the following method:
public void ServerInitializeStatsPlayer()
{
enabled = true;
foreach (var kvp in baseStats.baseStats)
{
var stat = new Stat
{
baseValue = kvp.Value.GetValueAtLevel(serverPlayerExperience.GetCurrentLevel()),
type = kvp.Key
};
stat.OnValueChanged.AddListener(UpdateStatDependentComponents);
stats.Add(kvp.Key, stat);
}
currentHp.Value = ServerGetStatValue(StatType.MaximumHealth);
currentEnergy.Value = ServerGetStatValue(StatType.MaximumEnergy);
currentPower.Value = ServerGetStatValue(StatType.MaximumPower);
OnHealthChanged.Invoke(currentHp.Value, ServerGetStatValue(StatType.MaximumHealth));
OnEnergyChanged.Invoke(currentEnergy.Value, ServerGetStatValue(StatType.MaximumEnergy));
OnPowerChanged.Invoke(currentPower.Value, ServerGetStatValue(StatType.MaximumPower));
}```
The issue is that this method immediately stops executing and does not execute anything after the foreach loop. I cannot for the life of me figure out what is happening here, everything inside the loop is executed as expected and no exceptions are thrown and the game runs as expected otherwise...
I've tried debug.logs, and attaching debugger and stepping through this function, and it just stops completely after the loop.
Please help me, I'm completely at a loss.