|
I Instantiated a GUI Text Game object and put them in a array, but when i use Destroy(); nothing happens, i can see the objects in the scene hierarchy.
(comments are locked)
|
|
I Instantiated a GameObject not a GUIText, and then Destroy worked as hoped. Also a can get/set the information for the GUIText from the object I just used for example
but it seems that you can also call the gameobject of the GUIText like this
not sure if it works with instantiated objects.
(comments are locked)
|

Try
Destroy(gameObject);I don't believe there's a parameteless overload for the Destroy method.
I did't want to copy the hole text but i tried
Destroy(planetLabels[i]);
and
Destroy(planetLabels[i].GetComponent(GameObject));
because the component of the object is GUIElement
@simeonradivoev
You wouldnt call its gameobject component like that, try this
You may need to edit the length of your array to remove the empty slot. If you are using Array() you can use remove at
which will be called after you call destroy, if you remove the slot first you wont have the path to that gui text
I Instantiated a GameObject not a GUIText, and then
Destroyworked as hoped. Also a can get/set the information for the GUIText from the object I just used for exampleNameOfGUIText.guiText.text = "some text"@simeonradivoev
If you did want to reference the GUIText itself you can use the method i provided( adding .gameObject to the array ref). Sounds like you found your answer?