• 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 LijuDeveloper · Oct 13, 2013 at 05:03 AM · guiguitexturemultipledrawcallsreduce

Reduce Draw call for Multiple GUI Textures with same Texture

I have multiple GUI Textures with same texture in my game. It results large number of DrawCalls . How to reduce DrawCalls using common textures ?

Example code

 using UnityEngine;
 using System.Collections;
  
 public class Example : MonoBehaviour 
 {

   public GUISkin MyGUISkin;

   void OnGUI()

     {

       GUI.Box ( new Rect ( Screen.width*0.1f,Screen.height*0.12f,Screen.width*0.49f,Screen.height * 0.58f),"",MyGUISkin.customStyles[1]);

       GUI.Box ( new Rect ( Screen.width*0.1f,Screen.height*0.22f,Screen.width *0.49f,Screen.height * 0.58f),"",MyGUISkin.customStyles[1]);

     }


  }
Comment
Add comment · Show 6
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 robertbu · Oct 22, 2013 at 05:52 AM 0
Share

I notice that you keep bumping this question back to the top of the queue. Are you looking for something else you don't feel is answered?

avatar image nicloay · Oct 22, 2013 at 07:13 AM 0
Share

Don't worry about DrawCalls in GUI system, 4th version is optimized well, so see to FPS not to drawcalls. I've made some tests: own sprite system VS OnGUI and found that CPU usages is the same, FPS the same. just small difference in GPU statistics. On this video http://youtu.be/1SmWcfDFgag there are 2 scenes, black background - 1 draw calls (planes and atlas), blue background OnGUI. (sorry for video quality it record desktop quite bad, and you can see not smooth movement of textures)

avatar image LijuDeveloper · Oct 22, 2013 at 07:27 AM 0
Share

i use 4.2 version of Unity . In my project DrawCalls is 70. Is it work on mobile platforms.

avatar image nicloay · Oct 22, 2013 at 07:49 AM 0
Share

sure, for example, here is my application which has about 70-100 drawcalls for GUI, and work the same as with own sprite system(similar to ngui or ex2d and so on) ![alt text][1]

just avoid to use Layout system, and cash all your position (Rect) values.

screen shot 2013-10-22 at 11.47.39 am.png (444.4 kB)
screen shot 2013-10-22 at 11.47.39 am.png (444.4 kB)
avatar image LijuDeveloper · Oct 23, 2013 at 05:06 AM 0
Share

Is it work on IOS and Android

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Eric5h5 · Oct 13, 2013 at 05:04 AM

You can't do that with OnGUI code. You'll have to use something else, like a third-party GUI system.

Comment
Add comment · Show 2 · Share
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 LijuDeveloper · Oct 13, 2013 at 05:13 AM 0
Share

can you explain it ?

avatar image robertbu · Oct 13, 2013 at 06:56 AM 1
Share

Third-party solutions like NGUI and EZGUI build their UI in world space and use Texture Atlases and a common material so that drawcalls batch. $$anonymous$$ore info:

http://answers.unity3d.com/questions/14578/whats-the-best-way-to-reduce-draw-calls.html

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

17 People are following this question.

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

Related Questions

reduce the GUITexture drawcalls 2 Answers

HUD with a lot of elements, efficient way? 3 Answers

Group GUI Objects to reduce draw calls. 0 Answers

Using screencapture to reduce expensive draw calls. 2 Answers

Is it expensive to use SetPixels() every frame for a second or 2? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges