• 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 stevenson · Jan 10, 2016 at 09:02 PM · uiperformanceprofiler

Many UI Elements - Bad GraphicsRaycaster performance?

Hi,

in my scene i have a complex ui with a few hundrets elements (Text, Button, Images..). Of course they aren't active at the same time. They are all childs of a parent Canvas gameobject (screenshot in attachment).

Now I have the problem, that the Graphic Raycaster(it's the only one in the whole scene) has a really bad performance. The performance is bad too, when all ui objects are deactivated.

alt text

It seems thats because of having so much UI elements in the scene. It doesnt makes a difference if i activate or enable the ui gameobjects. Only when I delete them, the Calls number goes down.

So is this a bug or what can I do?

Thanks for each answer!

alt text

t4fpa.jpg (187.0 kB)
aaaa.png (47.8 kB)
Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by vicilux · Mar 07, 2016 at 01:15 PM

I also met this problem about a month ago.

alt text

this is my thing, I have a huge big canvas, you can see the raycast is crazy. 33523 times called. WHY? BECAUSE unity graphicRaycaster check every single child object when I move my mouse, regardless of it's status active/inactive.

I have many inactive objects which cause very poor performance.

Here's the solution: Never add Graphic raycaster to a root canvas which contains many inactive objects. Do use different canvases, when you deactivate the canvas, the attached raycaster won't run. I used this method and everything is working ok.

You don't have to change the hierarchy too much, just remove the raycaster component on the root canvas, add raycaster to child ui, it will automatically add canvas component.

Another thing*, remember to uncheck the "Raycast Target" attribute* of images or text if they are just for display. Otherwise it will also effect performance.

After doing all these things, It dropped from 33k to a few hundreds which is so pleasant. Good luck.


screen-shot-2016-01-10-at-50315-pm.png (139.4 kB)
Comment
Add comment · Show 1 · 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 vicilux · Mar 06, 2016 at 08:51 PM 0
Share

Deactivate children objs just won't tell the raycaster to skip them. You need to add more canvas, deactivate the canvas to stop the GraphicRaycast script from running!

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

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

Related Questions

UI Text Optimization? Updating Geometry seems to be slow 0 Answers

How to increase performance? 0 Answers

Why is UI taking this much performance and how to reduce it? 1 Answer

How do I get my game to run faster? 4 Answers

Profiler Alpha Mobile 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