Hello folks; first, I want to say amazing job overall with Unity 3.0 - loving the changes so far (simply having a “search” on the hierarchy made me a very, very happy man with my projects larger scenes). For my smaller projects the conversion was easy and the results were great; however, I’m working on a rather large RPG that is not moving over as smoothly.
I was getting around 30 FPS in 2.6 (not amazing, I know - we have 2000+ draw calls in some areas, the placeholder art is all high-poly and utilizing way too many sub-meshes) - however, I’m hardly getting 10 with 3.0
The main issue seems to be OnGUI (GUI.Repaint is taking around 80% of my total frame-time). My smaller projects all only have 1-3 active classes with OnGUI - however, the large RPG depends on significantly more.
One class which really exemplifies the issue is our Tooltip class. Tooltip is the base of all our contextual cursor/mouse interaction and also has an OnGUI call which renders a tooltip when the mouse is over the object. Now, I’ll be the first to admit that this was an awful way to implement the tooltip - and I will be rewriting it shortly to be an OnMouseOver() { SingletonTooltipClass.SetTooltip(text)} and have only a single OnGUI call for this instead of having one on every object with an OnGUI call.
However, while the major issue does seem to be with the way my code was set up - the staggering difference between 2.6 and 3.0 efficiency at handling OnGUI calls makes me wonder if there is something else going on here. I can greatly reduce my OnGUI calls; however, even leaving only the important calls still leaves my performance lower than pre 3.0 (around 15-20 calls still if I had to guess).
Has anyone encountered similar results moving over to 3.0? Does anyone have suggestions for working around this if you absolutely need a moderate number of OnGUI calls? Would it make sense to do something like this:
public class GUIManager : MonoBehavior {
void OnGUI(){
if (shouldDrawSecondClass){
secondClass.MockGUI()
}
}
}
public class secondClass : MonoBehavior {
public void MockGUI(){
}
}
(of course passing the Event.current over to the MockGUI call if that’s even possible)
========
Thanks in advance for any feedback!