GUIText not visible?

Hi,

I have a script that’s loading a new level. There is an object with many children that is kept alive through a DontDestroyOnLoad call. This has variables such as score, timer, etc… that should be kept throught the different levels.

I have one object which has a GUIText component. Upon opening the new level I want to show the score, health, timer, etc. on the screen in the GUIText. Now this all works well inside the editor, but when I do a web build, the text never shows up. I know the text is being set, because I can see that in the console log. I also, know the GUIText object survives the level load because I’m logging it’s existence and it exists. I also know the the GUIText is enabled. I even tried setting the color of the GUIText just to make sure, but nothing seems to work.

Any suggestions?

Thanks,
Sandro

I figured it out. I set a tag to the object that has the GUIText. I’m thinking the correct GUIText was not being found when I was using the FindObjectOfType().

On a seperate note, is the use of tags any better/worse, performance-wise?

Thanks,
Sandro

All functions that have to search for something are slow. If you have code that uses them in Update(), FixedUpdate() or in tight loops, try and move the search function to Start() and cache the reference you get from it.