#Drawing a custom cursor in OnGUI method
1 messages · Page 1 of 1 (latest)
But I draw the cursor in OnGUI method, do you say it'll have a huge impact on the performance?
private void OnGUI()
{
// ...
GUI.DrawTexture(rect, currCursor.cursorData.cursor);
}
im not saying its huge, im saying its about 2ms per frame
I am sorry, but it that a lot?
just when gui is called anywhere in the project and does nothing, there is a cost to that
16ms is 60 fps
1/60 = ~16
2ms is 12.5% of 1 frame at 60 fps
those numbers vary based on the hardware ofc
I see, I do more than just drawing the texture in OnGUI
Guess it may cause some troubles
perhaps you have anything to recommend me?
Is it possible to achieve the same functionality using it as in GUI?
you can do much more with UGUI than you can with GUI
methods/approach is fundamentally different
GUI loops 10 times through all the code every frame, and redraws (which means the vertex buffers are being rebuilt) every frame
UGUI is retained, objects are created once and then drawn, and there is very little code invocation
you should spend time learning UGUI, there is also UITK but i cant vouch for its readiness for actual games and its also a different approach to both
I see, I know I can just search the web, but maybe you have a source you could recommend me?
i dont, try standard unity learn
sure, thank you for your help 😄