Should I be using OnGUI?

Hey all,

I’m just reverse engineering the NetworkManagerHUD (available from this forum FYI) and I’ve noticed that they are using a lot of OnGui. Yet I was under the impression (from things said on some of the Live sessions) that I should try not to use OnGUI, and instead use the new UI/Canvas system.

So, did they use OnGUI because they can quickly do GUI stuff in code? Or is it alright to use OnGUI, despite what I heard? I’m guessing that it’s a good idea to understand the basics of OnGUI (for this type of situation), but should I spend a lot of time on it if it’s now deprecated?

As always, many thanks for input and thoughts. Peace out y’all!

Legacy GUI is slightly faster the UI for throwing up ugly debugging buttons or editor scripts. It’s not intended for production code.

Understanding OnGUI is great if you do a lot of tools and editor scripting.

1 Like

The OnGui approach is harder to design for and runs less efficiently, but is really easy to throw up stuff like debug messages from code.

1 Like

@jhocking and @Kiwasi

Many thanks for the replies, guys (Hey, that rhymes!).

That answers that simple question. I’ve been able to understand that basic stuff of it, so I’ll learn some basic stuff for debugging and reverse engineering, thank you.

Er, can I ask another question? Still to do with the NetworkManagerHUD source… just trying to get something to work without replicating the OnGUI approach…

1 Like