S
S
SKLLZ12020-06-17 15:01:21
Unity
SKLLZ1, 2020-06-17 15:01:21

How to wait 2 seconds when switching to another scene, without stopping time on the current one?

So, there is a ship, it flies. The ship can explode if something collides with it. But, if something collides with him, you need to show the player that he lost (switch to another scene, like you lost).
And the question itself: How to let the scene live for another 2 seconds, so that the animation of the explosion of the ship would play, and only then switch to another scene?
I tried using Thread.Sleep(2000), but there was a problem - it goes on for 2 seconds, but the picture on the stage with the game freezes for 2 seconds, and then it actually switches as it should.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Almost, 2020-06-17
@SKLLZ1

Coroutines will help you.
https://docs.unity3d.com/ScriptReference/WaitForSe...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question