Hello guys,
I’m having a problem that is freaking me out.
So a Have a code like that
List<GameObject> list = new List<GameObject>();
Start(){
for(in i = 0; i< 10; i++){
Transform clone = (Transform) Instantiate (prefab, vector, quart);
list.add(clone.gameObject);
}
}
public GameObject getPrefab(){
foreach(GameObject g in list){
if(!g.activeInHierarchy){
g.position = ....
g.rotation = ....
g.setActive(true);
return g;
}
}
}
So i have that functions but the first time that I get a prefab game have a hiccup, but the secound don’t happens the hiccup.
I can’t understand why because all objects are instantiated.
Example 3 lists ListA - 5 obj , ListB - 2 obj , ListC - 3 obj
listA.getPrefab() hiccup
listA.getPrefab() no hiccup
ListB.getPrefab() hiccup
ListC.getPRefab() hiccup
ListB.getPrefab() no hiccup
....
Hiccup only happens the first time that I set one gameobject from a list to visible, but if listA and ListB are list of same gamebject it only hiccup in the first list that calls getPrefab().
Any type of solution?