GUIText draw call outside screen?

i just notice about this behaviour, i thought GUIText works the same way as the other 3D object.

it turns out, even when the GUIText is outside the camera viewing area, the “draw call” is still considered.

I have a player inventory that store all text in GUIText and player can scroll it,
i thought i don’t need to hide/deactivate it if the GUIText is outside the screen, but now i guess i have to track each inventory position and hide it when it’s outside viewing area…

I’m trying to use 3D Text instead, but the text is all blurry…

sigh… more work to do :cry:

As the gui stuff in Unity is intermediate and handled independent of the camera rendering aspects (otherwise it wouldn’t be always in front), it is rendered always. If you don’t want to render it, there are a few very simple mathematic tricks to decide to not do so like checking if (3d object position - cam position) dot project with the camera Forward vector is > 0. if so, activate the renderer. if not, disable the renderer.

It’s called “immediate mode”, not intermediate, and I’m not sure the OP was even discussing UnityGUI, they explicitly mentioned GUIText which is the “old school” way to go about things. :slight_smile:

If you know that you’re moving elements off-screen then it’s likely best to disable them and avoid any potential of extra draw calls, especially on the iPhone where performance is more sensitive than on the desktop or web.

As a tip, check out the Sprite Manager thread, good stuff over there. :slight_smile:

I knew there looked something strange.

I know that GUIText and GUITexture are not GUI
But in this specific case when it comes to rendering, they actually behave alike.

Above solution is also what is integrated in our project to prevent it killing the performance as we use GUIText and GUITexture for object specific content above “their head”.
The nice thing is that you you add a second check and not only make it disable stuff behind the camera but also stuff too far away for example.

nicee…
thanks for the explanation Dreamora HiggyB

for now maybe i’ll just enable/disable it when the
PixelInset.x / y is outside screen boundary :wink:

but yeah it’s just surprised me at first when i saw that moving GUIText outside the screen still cost a draw call :?