Hello guys i’ve been going crazy for the past few hours trying to figure out what i could possibly be doing wrong. I have a fair bit of knowledge in both c# and unity’s librarys. What my method is doing is scanning a List to and accesses the particular country gameobject. After the GO(gameobject) is found it scans the scripts list of objects(Tagobjects). I then attempt to access the GO’s bool variable,however i get a error once i try to read the proviencewindowdisplay script in the gameobject.
foreach(Country country in EnemyCountrysList)//accessing country objects in list
{
Country tempcountryinstance = country.GetComponent<Country>();
foreach(GameObject GO in tempcountryinstance.TagObjects)
{
ProvienceWindowDisplay display = GO.GetComponent<ProvienceWindowDisplay>();//display gets component data for Specific GO
if(display.BorderProvience)//NULLREFERENCEEXCEPTION HERE
{
if(tempcounter == 0)
{
BorderProviencesList1.Add(GO);
}
if(tempcounter == 1)
{
BorderProviencesList2.Add(GO);
}
}
}
tempcounter++; //temp counter increment cause a new list to be populated with a different country instances proviences
}