Unity zPosition hierarchy is making me insane.
Please help.
Debug.Log(GameField.transform.parent.name); // Returns Level
Debug.Log(GameField.transform.GetSiblingIndex()); // Returns 0
GameField.transform.SetAsFirstSibling();
if (firework1Exists == false) {
Instantiate (Firework1, transform.position, Quaternion.identity);
Firework1.SetActive (true);
firework1Exists = true;
Firework1.transform.parent = Level.transform;
Firework1.transform.SetAsLastSibling ();
Debug.Log(Firework1.transform.GetSiblingIndex ()); // Returns 5
Debug.Log(Firework1.transform.parent.name); // Returns Level
Fireworks are ALWAYS behind the Gamefield no matter what I do. I've tried putting them at the root Level object below ('after') gamefield in the project hiearchy. I've messed with zPos, I have tried GetSibling() stuff. It's just simply impossible to easily tell a prefab anywhere in the game that it should supersede all others.
I'm going to have to buy a new keyboard and monitor soon.
Comment