To start with, I'm getting this error:
NullReferenceException: Object reference not set to an instance of an object
AbilityUIManager.PopulateNPCScores (System.Int32 npc_agVal, System.Int32 npc_endVal, System.Int32 npc_chaVal, System.Int32 npc_miVal, System.Boolean isPlayer) (at Assets/Scripts/AbilityUIManager.cs:51)
Which is referring to this line:
npc_agValDisp.text = npc_agVal.ToString();
Of this code:
public class AbilityUIManager : MonoBehaviour
{
[Header("NPC Ability Score Value Fields")]
[SerializeField] TextMeshProUGUI npc_agValDisp;
[SerializeField] TextMeshProUGUI npc_endValDisp;
[SerializeField] TextMeshProUGUI npc_chaValDisp;
[SerializeField] TextMeshProUGUI npc_miValDisp;
void OnEnable()
AbilityCheckManager.PopulatedNPCScores += PopulateNPCScores;
}
void PopulateNPCScores(int npc_agVal, int npc_endVal, int npc_chaVal, int npc_miVal, bool isPlayer)
{
if (!isPlayer)
{
npc_agValDisp.text = npc_agVal.ToString();
npc_endValDisp.text = npc_endVal.ToString();
npc_chaValDisp.text = npc_chaVal.ToString();
npc_miValDisp.text = npc_miVal.ToString();
}
}
void OnDisable()
{
AbilityCheckManager.PopulatedNPCScores -= PopulateNPCScores;
}
}
I'm confused, though, because npc_agValDisp.text is correctly working on the First set of integers to go in, but not the second set. I'm wondering if this has to do with PopulateNPCScores somehjow unsubscribing from the event that populates it?