Hi, i have made a script to create game object “texts” than added a guiText to it (working on a 2D game). Now i added an other game object (direct on the scene) that should hide the guiText, but i can’t hide it the guiText still in front. I did a code to define “texts” layer order but doesn’t work. here is the code, i don’t know if it is the right solution.
Thanks for your suggestions
texts = new GameObject ("Texts");
texts.transform.position = Vector3 (0.5, 0.5, 0.0);
var sr : SpriteRenderer = texts.AddComponent(SpriteRenderer);
sr.sortingLayerName = "Default";
sr.sortingOrder = 1;
texts.AddComponent (GUIText);
texts.guiText.font = font;
texts.guiText.fontSize = 20;