I'm kinda losing my mind over this but for some reason when I call a function via an unity event the button sometimes isn't receiving it's AddListener. I've tried to disable every other method that calls the event so I'm sure it only gets a listener in that specific case but still nothing
void UpdateSkillDisplay(SkillManager unitSkillManager, SkillDisplayContext reason)
{
Debug.Log(unitSkillManager);
tempSkillManager = unitSkillManager;
for (int i = 0; i < skillSlots.Length; i++)
{
int slotIndex = i;
SkillData skill = tempSkillManager.GetCurrentSkill(i);
switch (reason)
{
case SkillDisplayContext.SkillReplace:
skillSlots[slotIndex].SkillInteraction.onClick.RemoveAllListeners();
skillSlots[slotIndex].SkillInteraction.onClick.AddListener(DebugFunction);
Debug.Log($"Reason is Level Up and skill is {skill} + Slot {slotIndex}");
break;
case SkillDisplayContext.Attack:
if (skill != null && reason == SkillDisplayContext.Attack)
{
skillSlots[slotIndex].SkillInteraction.onClick.RemoveAllListeners();
skillSlots[slotIndex].SkillInteraction.onClick.AddListener(() => PlayerGameActions.onPlayerSkillUse.Invoke(slotIndex));
Debug.Log($"Reason is attack and skill is {skill}");
}
break;
default:
break;
}
skillSlots[slotIndex].Setup(slotIndex, skill);
Debug.Log($"Final state - Slot {slotIndex}: Interactable={skillSlots[slotIndex].SkillInteraction.interactable}");
}
}