- Home /
Better performance? GUITextures or Texture2D drawn in function OnGUI?
Hello,
I am displaying 2d graphics like background images, menu selection buttons, back button ...etc
Each time I use a method trying the easiest and less development but prefer to know the better way for performance..
For example I have a background to display, I could do:
Create guitexture in heirarchy, drag and drop a texture in inspector. (I have a variable of type guitexture in my script, so that I can set the pixelInset values from inside the script).
Create a variable of type Texture2D , drag the texture to its corresponding variable in the inspector and display by callign GUI.Drawtexture in function OnGUI().
Which one is better (CPU,Memory) or any other benefit one over the other?
I'm guessing GUITexture, because Texture2D is only really meant for textures you want to edit during runtime.
Well isn't this some topic never talked about before? No one got an answer for me! Well I am planning to make tests for both and post here the draw calls, .. etc
Yes drawing the actual pixels will be the same process - the setup around it is what will change.
Have you considered using GUI middleware like NGUI or ScaleForm? They will try to do a lot of drawing optimizations for you.
Your answer
Follow this Question
Related Questions
GUI.DrawTexture() into a Layer? 1 Answer
iOS OnGUI vs Update for color picker 2 Answers
When to use OnGUI() ? 1 Answer
"null texture passed" for any texture2D other than the 2 originals. 1 Answer