GUILayer.HitTest bug in the Game View window

I reported this problem in another post, but I’m posting it here because I identified how to replicate it.

If we use the default game view (e.g. from the 2 Split Layout), the calculations of GUILayer.HitTest work correctly.

However, if I expand the size of the game view manually, it continues to calculate them with the height of the default game view. This only seems to happen in Y axis, since when I expand the window in the X axis, the GUILayer.HitTest continues to work correctly.

If we run the game with ‘Maximize on Play’, it adapts and calculates correctly.

Regards,
Afonso

So from your report this sounds like an authoring-only bug? Or do you also see issues in the web player and/or stand-alone player? Either way please be sure to report the bug and include a (simple) project folder, thanks!

I’ve made a simple scene and sent it through the bug report app. I found out that this only occurs when I use Camera.current.GetComponent(GUILayer).HitTest. If I use Camera.main, it works fine. I thought that Camera.current was the current “active” camera, but it seems that I’ve misunderstood.
I saw in the docs now that it is supposed to be used only on certain functions, don’t understand what is current camera’s purpose. :-\

My simple (and incomplete as of right now) understanding of Camera.current is that it’s for lower-level rendering control, like your own post-processing effects for example. For your purposes you’ve found the right solution, Camera.main.