im not sure if the mix of using a LIST and a reference to an object inside an Coroutine cause an permament exception… look at this code im already calling the object One Code line before the exception with No problems so the object exist in the moment of the caller, i may think the list.add method is just used in the next frame… or something like that… in that case i would have problems … can anyone figure out reasons?
IEnumerator RowCheck(int Fila)
{
for (int i = 0; i < 4; i++)
{ // 0 , 1 , 2 , 3
Vector3 posicion;
int buscador = Fila + i;
string cadena1 = buscador.ToString();
string color1 = "Null1";
string color2 = "Null2";
string color3 = "Null3";
string color4 = "Null4";
string color5 = "Null5";
string color6 = "Null6";
GameObject objeto1 = GameObject.Find(cadena1);
if (objeto1)
{
if (objeto1.GetComponent<MainGameCube>().iamready == true)
{
color1 = objeto1.GetComponent<MainGameCube>().elcolor;
}
}
string cadena2 = (buscador + 1).ToString();
string cadena3 = (buscador + 2).ToString();
GameObject objeto2 = GameObject.Find(cadena2);
GameObject objeto3 = GameObject.Find(cadena3);
if (objeto2)
{
if (objeto2.GetComponent<MainGameCube>().iamready == true)
{
color2 = objeto2.GetComponent<MainGameCube>().elcolor;
}
}
if (objeto3)
{
if (objeto3.GetComponent<MainGameCube>().iamready == true)
{
color3 = objeto3.GetComponent<MainGameCube>().elcolor;
}
}
if (color1 == color2 && color2 == color3)
{
string collig = objeto1.name;
objeto1.tag = "prematch";
objeto2.tag = "prematch";
objeto3.tag = "prematch";
// ADD VERTICAL DESDENCER TO PREVIOUS CUBES
destruidos.Add(collig);
etc.. etc.. etc..
yield something etc..
The exception jumps on the destruidos.Add(colling) telling me theres no refence of the object ( it means objeto1 reference has destroyed or not set at this moment and just a line before it sets to the same refeence a new tag…) im very confused… please help