- Home /
Connecting to internet slows down my game?
Hi, I'm a beginner in unity and made a small game but the problem is my game lags when it is connected to internet.
I have used facebook sdk 6.0.0 but that is in the first scene of my game and the actual part in the second scene so why there is a lag in the game??
Thanks in advance.
Look for any parts of your code which wait for an internet response. Also, handling such things with Coroutines will halt your main thread.
Actully there is only facebook integrated and unity ads. Rest nothing is used. Also the unity ads are called through a coroutine. Is that causing the problem?
It could very well be causing the problem. A coroutine is very different to a thread. While a coroutine is waiting for anything the main thread is blocked.
$$anonymous$$ake sure that the coroutine has appropriate yield statements to allow it to continue the main thread and pick up the coroutine next frame.
I dont think that Advertisement.isReady() is making it slow as it is not called in between the gameplay rather called when there is an end game menu.