• 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 lazybitkings · Jun 28, 2020 at 04:01 PM · androidandroid buildlagmobile deviceslaggy

Semaphore.WaitForSignal is causing so much lag on Android!!! Help!!!

Hi,

I have made a small and relatively simple 3D game that I want to upload to Google Play. I built the .apk to my phone for testing and in the beginning it went well. Playing went smoothly (60 fps) but after a couple of minutes I started getting about 35 fps. I noticed about 5 - 10 small spikes, then after a scene reload in the game, I was stuck at about 35 fps.

I did some investigating in the profiler and found that Semaphore.WaitForSignal seemed to be causing the issue.

Please help me!!!! Comment if you would like some images to clarify the issue!

Comment
Add comment · Show 2
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 soundarking · Jun 05, 2021 at 09:22 AM 0
Share

Hi, I also ran into the same! I tried to switch to the default render pipeline and it worked for me!,hi, I have also the similar problem where I used URP. I tried static batching and dynamic batching but Semaphore.WaitForSignal is taking 43ms. so i decided to switch to the default render pipeline and god damn it worked for me! now my game is running 60 fps. so just try to switch to the default render pipeline in case if u use URP!

avatar image fleity · Jun 05, 2021 at 02:55 PM 0
Share

@soundarking i am not a hundred percent sure on this but I have encountered this once on an oculus quest project. Urp renders to a intermediate render target by default (called color buffer). In the editor this is necessary but in builds you can write directly to the swap chain render targets (which oculus recommends). The texture switch costs a lot of gpu time and almost always pushes you beyond the 90 fps ti$$anonymous$$g. If you feel comfortable editing the urp files it can be fixed though.

It's sad that switching back to built in is still so often the only fix for these kinds of issues :-/

1 Reply

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

Answer by lazybitkings · Jul 01, 2020 at 09:28 AM

I solved it

I changed my fixed timestep from 0.5 to 0.013333 which eliminated the lag

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 fleity · Jul 01, 2020 at 09:57 AM 2
Share

Semaphore.WaitForSignal is a process which does something similar as vsync. it synchronizes gpu and cpu. If you say Semaphore takes a up a lot of frametime this can mean two things unfortunately. Either you are well under your frame budget (and gpu/cpu wait for the device target frame rate) or you are above your framebudget and you are missing the sync point to hand over the finished rendered frame and you are waiting until the next sync point resulting in bad fps.

why changing the physics step to something lower fixed it for you is beyond me but this might help you understand more about what the semaphore does: https://developer.oculus.com/blog/understanding-gameplay-latency-for-oculus-quest-oculus-go-and-gear-vr/

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

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

Related Questions

Mobile Game starts lagging after a while when playing on my phone!!!! Pls Help!!! 1 Answer

my android game lag sometimes 0 Answers

Android apk lags on all devices except of mine. :/ 0 Answers

Mobile build displaying faded images from other parts of phone on canvas objects,Game displaying faded images from other parts of my phone on ingame canvas objects 0 Answers

LAG when BACKGROUND OBJECT is ADDED ( mobile game) 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