This question was
closed Jan 20, 2017 at 12:44 AM by
Naivion for the following reason:
no longer an issue
Question by
Naivion · Jan 19, 2017 at 09:49 PM ·
nullreferenceexceptionobject-reference-error
null reference on this code
im getting a null reference on this code and i can't figure out why... if you can help it would be much appreciated... i wont post the whole script as my game scripts are large and vastly confusing :L
if(Targets.Count >= 1)
{
if (gameObject.GetComponent<Mob>().IsZombie == true)
{
List<Transform> transtemp = new List<Transform>();
foreach (Transform zombie in Targets)
{
if (zombie.gameObject.GetComponent<Mob>().IsZombie == true)
{
transtemp.Add(zombie);
}
}
foreach (Transform zombie in transtemp)
{
Targets.Remove(zombie);
}
}
Comment
Answer by IgorAherne · Jan 19, 2017 at 10:10 PM
plz post the full error message stack which you are getting as well
Follow this Question
Related Questions
Unknown Cause of NullReferenceException? 1 Answer
How can I fix this error? 0 Answers
Added Photon pun2 to 3d Game kit and got this error 1 Answer