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 freshgamer10 · Jun 24, 2014 at 01:24 PM · guifpsperformancemenu

GUI Menu Major Performance Issues

Hey,

I have been working on a trading system for some time and I got everything to work, but the menu is extremely laggy. The performance is about 170 FPS when I am not in the trade menu, but as soon as I open it, my frames drop to about 20 FPS and I have no clue why. I am using the exact same method of drawing these elements as in my inventory and the inventory stays at constant 170 FPS. Maybe you guys can help me somehow, I am clueless. I have tried so many things and nothing even slightly increased the frame rate.

The problem is the ShowTradeOptions() method.

     List<Item> tradeItems = new List<Item>();
     Item selectedItem = new Item();
     Rect moveRightButtonRect, moveLeftButtonRect;
 
     void ShowTradeOptions()
     {    
         for (int i = 0; i < availableItems.Count; i++)
         {
             GUI.Box(myItemsRects[i], "", gameDatabase.inventorySkin.GetStyle("Slot"));
             GUI.DrawTexture(myItemsRects[i], availableItems[i].itemIcon);
 
             GUI.Box(tradeItemsRects[i], "", gameDatabase.inventorySkin.GetStyle("Slot"));
             GUI.DrawTexture(tradeItemsRects[i], tradeItems[i].itemIcon);
          }
      }

Comment
Add comment · Show 3
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 freshgamer10 · Jun 24, 2014 at 02:01 PM 0
Share

I am sorry for bumping this post, but I really do need help with this. I have been tweaking the code and trying to find the problem for nearly 4 hours now. It just does not make any sense.

avatar image HarshadK freshgamer10 · Jun 24, 2014 at 02:22 PM 1
Share

Before we move on to the discussion about your problem, I would like to let you know that 'do not post comment as answer'.

Now moving on to your issue, we would need additional information like platform you are developing for to provide you with precise details.

One of the reason off the top of my head is that use of Unity GUI since Unity GUI is draw call heavy and you will get a performance hit due to it if there are just too much GUI elements are drawn on the screen. Also the GUI elements used also make a large difference. To know more about it read GUI Basics.

One of the options would be to use any GUI assets from asset store like NGUI or create one yourself using GUIElements.

Another option is that you can wait for new Unity GUI to come out (which people are waiting for a long time....) and then use that.

N.B.: I have converted your answer to comment for you this time. But just take care about it from next time. :-)

avatar image freshgamer10 · Jun 24, 2014 at 05:45 PM 0
Share

Thank you for your help and the clarification. I am developing my game for the PC and I have read the GUI Basics prior to posting this. The GUI is definitely draw call heavy, but I just don't understand why my Inventory menu is very stable performance wise and the trade menu is not. The inventory even has 45 draw calls, whereas the trade menu only has 43. It just does not make any sense that the FPS drops so significantly when the code I am using for the trade menu is way more efficient than the actual inventory script. The inventory even uses a nested loop. I have been waiting for the new GUI system as well, buying NGUI just because the FPS magically drop to an unplayable state does not really make me want to spend that much since I am not even doing anything special GUI-wise. There has got to be a reason for this performance issue.

1 Reply

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

Answer by freshgamer10 · Jun 24, 2014 at 06:14 PM

I am now posting an answer to my issue because I managed to fix it.

The issue was that I was trying to draw a texture that was null and Unity could not handle that properly. It does not give you an error, but it results in significant frame rate drops below the playable state.

So, I am now only setting a texture if the texture is not null.

Comment
Add comment · 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

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

21 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 avatar image avatar image avatar image avatar image

Related Questions

Creating Fps Game Menu 2 Answers

Graphics.PresendAndSync, CPU Usage Performance issue 0 Answers

Paused Menu backdrop 1 Answer

menu item and add gadjet 1 Answer

Close my GUI button by repressing the same Hot-key. 3 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