Y
Y
Yura Berezovsky2017-11-04 16:20:38
Search Engine Optimization
Yura Berezovsky, 2017-11-04 16:20:38

How to pause the execution of a method?

What are the ways to suspend the execution of a method? For example, to wait for a response from the player.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dimonchik, 2019-08-10
@dimonchik2013

fl.ru

S
Sergey Kormishin, 2017-11-04
@Jurajkeee

You can use a coroutine for this, but most likely you need another more elegant solution for your task.
After all, if the method does not have enough data to execute, then you should not wait inside the method, but call the method later, when all the data is already there.

T
TheTalion, 2017-11-04
@TheTalion

Delegates and events (google for these words). You break the method into two: what we do before the response, what we do after the response. Then in the first one we subscribe the second method to the desired event and wait until the client triggers the event and the second method automatically starts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question