Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by DannyLZS · Sep 07, 2012 at 05:18 PM · texturetexturesdrawcallsatlasdrawcall

DrawCall results are strange

I'm working on a mobile game and I am using a texture atlas. The problem is I had the beleif that using a texture atlas would mean 1 draw call for all textures but everytime I use part of the artlas my "DrawCalls" goes up by 2..... here's how I am calling it ...

 GUI.BeginGroup(new Rect(0,0,Screen.width,Screen.height) );
         
         foreach (GUIBit gb in SceneElements)
         {            
             if (gb.Show)
             {
                 if (gb.AtlasTextureNumber == 0)
                         Graphics.DrawTexture( new Rect(gb.x, gb.y, gb.width, gb.height), textureAtlas.texture, new Rect(textureAtlas.areas[gb.AtlasNumber]), 0, 0, 0, 0 );
     
                 if (gb.HasText)
                 {
                        GUI.Label(new Rect(gb.x, gb.y, gb.width, gb.height), gb.TextToShow, GuiStyles[gb.styleIndex]);
                     
                     GuiStyles[gb.styleIndex].normal.textColor = Color.white;
                 }
             }
         }
         
         GUI.EndGroup();

basically what I am doing here is loading in a texture atlas and then storing an array of points on the texture atlas these are the ... "textureAtlas.areas[gb.AtlasNumber]"

I am then storing an array opf "GUIBits" which store info such as which texture to use from "textureAtlas.areas[]" and where to display them on screen and a boolean for show or not so I can turn them on and off at run time.

So yeh, everytime I turn one on I am getting a +2 to the draw calls even though the texture is only added to my "TextureAtlas" class the once ?

Thank's for any help on this

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Screenhog · Sep 07, 2012 at 05:27 PM 0
Share

Draw calls aren't only affected by the textures you're using... they're also affected by the shader type of the texture, and by how light is hitting it.

If you start an empty scene and add a point light and a plane, you'll have 2 draw calls. Change the plane to have a VertexLit material ins$$anonymous$$d of its default Diffuse, and now you'll only have 1.

So, what shaders are you using? What lights are hitting it?

avatar image DannyLZS · Sep 07, 2012 at 05:42 PM 0
Share

That's the thing mate, I'm drawing them to the GUI .... They are gui elements ...

The piece of code I pasted is the entirety of my "onGui()" function inside my "GUI$$anonymous$$anager" which does all of this working out for me

avatar image Screenhog · Sep 07, 2012 at 05:48 PM 0
Share

You're right, I don't know why I missed that.

Well, I know that Unity's built-in GUI isn't particularly efficient, but I don't know any details. I've converted my answer to a comment in the hope that someone else will see this question as unanswered and will be able to provide an answer.

avatar image DannyLZS · Sep 07, 2012 at 05:58 PM 0
Share

thankyou anyway

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Texture atlases on iphone 3 Answers

Multiple Tiling Textures in the Same Material 1 Answer

Reducing drawcalls on texture atlas animation 0 Answers

Particle System Draw Calls 1 Answer

Draw Calls Not Reduced After Adding Texture Atlas. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges