• 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 TobyKaos · Oct 24, 2015 at 08:14 AM · 2draycastoptimization

Optimize 2D menu game by disabled raycast target

Hello,

I am making a 2D game with many menu page (50) in the same scene. I only activate menu page at once and popup, footer and header.

But I noticed slow down on Android. I wonder if disabled all raycast target (in UI Image) that are not usefull will help to optimize?

I work with Unity 5.2. I have many sprites using sprite packer with default compression activated.

Comment
Add comment · Show 1
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 npatch · Oct 24, 2015 at 10:36 AM 0
Share

Theoretically it does since it marks things to be ignored in raycasting but it would probably be unnoticeable. Try it but make sure to uncheck only the Image components that do not really nead to be raycasted like Panels etc.

Is the perf slowdown happening only when you activate the menu?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by TobyKaos · Oct 26, 2015 at 08:33 AM

I have tested with profiler and noticed that event system script is the bottleneck. When I desactivate EventSystem object(more precisely Event System script), then fps is 100.

Comment
Add comment · Show 8 · 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 npatch · Oct 26, 2015 at 08:39 AM 0
Share

EventSystem is what keeps track of the collision events on UI. If anything its important. http://docs.unity3d.com/ScriptReference/EventSystems.EventSystem.html

avatar image TobyKaos npatch · Oct 26, 2015 at 09:04 AM 0
Share

Yes I know it is important but take 93.4% of CPU usage. $$anonymous$$aybe a bug or maybe I must inactive all raycast target checkbox that are note use for UI button, list, ...

As I tell before I have a huge menu scene with 50 menu pages. I desactivate all page except the one currently viewed or 2 if I run a transition.

Then maybe EventSystem script pass through all gameobject even if desactivated??

avatar image npatch TobyKaos · Oct 26, 2015 at 09:10 AM 0
Share

50 menu scenes ? This is probably the reason why...$$anonymous$$aybe you can optimize your menu ins$$anonymous$$d. Like deactivate the menu scenes that are not being used at all and activate them only when they're supposed to be active or at least during play that they're accessible.

Show more comments

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

39 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

Related Questions

How does Raycast2D works? Am i doing it right? [Huge Line] 1 Answer

Physics2D.Raycasting questions 0 Answers

Physics.Raycast doesn't hit anything even though Debug.DrawRay works 1 Answer

How to make Standard Shader _Color property be Per Instance Data? 0 Answers

RaycastHit2D never contains a collider 2 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