Quantcast
Channel: Answers for "How to use yield within a class function"
Viewing all articles
Browse latest Browse all 4

Answer by whydoidoit

$
0
0
You have to start them as coroutines - normally Unity does that if you call it from within a MonoBehaviour. If you want a utility class then you are going to need a utility MonoBehaviour script to run the coroutines on. In other words you need a script that's purpose in life it to execute your coroutines from your library. It could be as simple as: #CoroutineSupport.js static var instance : CoroutineSupport = this; function RunCoroutine(coroutine : IEnumerator) { return StartCoroutine(coroutine); } Then to start a yielding library routine you would use: CouroutineSupport.instance.StartCoroutine(someCoroutineFunction());

Viewing all articles
Browse latest Browse all 4

Trending Articles