I have a scene when enter a debuff will be played where if one of the characters is named "Gregor" the debuff will be added to that character delegate the issue is I am getting a null refence and I don't know why it is happening.
There are there scripts in play for this
Board: At start set the two character objects with the character then call their debuff
SecondPerson = StaticInfo.instance.RightDate;
person.useDebuff(this);
person.checkOtherPersonDebuff(SecondPerson,this);
brokenHeartCallBack += duoHatedTokenEffect;```
DuoPersonCarry: this script job is to track which character is in focus and have a ref to it's person
```if (LeftOrRight)
{
person = StaticInfo.instance.leftDate;
}
else
{
person = StaticInfo.instance.RightDate;
}```
Finally the special debuff with the null error
```DuoPersonCarry[] twoperson = FindObjectsOfType<DuoPersonCarry>();
foreach(DuoPersonCarry person in twoperson)
{
Debug.Log(person.getperson().Personname);
if (person.getperson().Personname == "Gregor")
{
if (person.checkeng == null)
{
Debug.Log("The debuff is added");
person.checkeng += allowOrNot;
}
}
}```
so the debug.log is giving me the null error but the weird part is that this is being called twice it is working well for the first one but the error happens on the second person and I don't know why.
