- Home /
Is waitforseconds in a coroutine related to sephamore.WaitForSignal?
I have been having major performance issues involving Sephamore.WaitForSignal. In the profiler it is taking up 22ms of cpu time. I have seen multiple threads with no solution. I have an idea, but need confirmation on whether or not it's related. In quite a few of my scripts I have coroutines with "yield return new WaitForSeconds() written in them. Is there any chance that this could be related to the Sephamore.WaitForSignal? My performance was relatively fine a few days ago, this issue just came into existence. Thanks!
My Profiler https://gyazo.com/935514d3eeeb1a4c9012a4383ce264fd
My Profiler 2 https://gyazo.com/dc936ab02d98e3c5080fe4d1d57d26d9
Answer by Namey5 · Feb 25, 2021 at 10:26 AM
The two have nothing to do with each other; in fact 'WaitForSeconds' is a yield that actually achieves the opposite effect - it stops code from executing without blocking the main thread. That semaphore means that the CPU is stalling on the GPU, waiting for it to complete some kind of rendering command. I would enable GPU profiling and go from there to see what is taking up the frame time.
Answer by andrew-lukasik · Feb 25, 2021 at 10:49 AM
yield return new WaitForSeconds()
has nothing to do sephamore.WaitForSignal
, 100%.
yield
instructions are for enumerators while semaphores are part of multi-threading infrastructure.
WaitForRenderThread
means that your main app thread (it's top one in timeline view and is even labeled "Main Thread") is waiting for "Render Thread" to complete it's work. In other words: your CPU is busy with rendering-related work there and can't draw a frame until it's done.
Your answer
Follow this Question
Related Questions
Performance spikes 1 Answer
Camera.render weird issue? 0 Answers
Unity Profiler 0 Answers
How to solve performance issue with Camera.Renderer->Drawing ? 1 Answer
How to get OpenGL frame capture under XCode in Unity4? 0 Answers