c# - IEnumerator yielding to the result of another IEnumerator -
I have two classes in my project
In a first-class press, I press a button I'm calling the first IEnumerator
at:
if (GUI.Button (new review (250, 0, 100, 20), "clear")) {startcourtine (Foo.test ()); }
The way to call looks like this (in the second category):
public static IEnumerator test (yield returns) StartCoroutine (DownloadAndCache); // do stuff}
However, once this gets a return from a second IEnumerator
, then I only use this method to complete my tasks I am intending to wait and wait a few seconds to get results.
This method looks like this:
IEnumerator DownloadAndCache () {// Ready to be prepared for the caching system (! Caching earned) yield returns empty ; Debug. Log ("download asset bundle"); // Load the AssetBundle file from the cache if it exists with the same version or downloading it and downloading it in the cache (WWW www = WWW.LoadFromCacheOrDownload (jsonURL, version)) {yield returns www; If (www.error! = Null) {new exception was put ("There was an error in the WWW download:" + www.error); } Assetbundle bundle = www.assetbundle; If (AssetName == "") {Instantiate (bundle.mainAsset); } And {instant (bundle load (estnet)); } Bundle. Descend (wrong); }}
However, when I apply it, my test method claims to not be set for an example, I do not want to make a new copy of these scripts because every time I Will there be a need to reset the link? Is there any way I can get this to work?
The error I get is as follows:
Unstable member 'UnityEngine' MonoBehaviour.StartCoroutine (System.Collections.IEnumerator) '
< / Blockquote>
The problem is not really anything to do with Coroutines.
This is because you are trying to call two example methods with a static method, DownloadAndCache
and StartCoroutine
are examples of methods, they are not static, so they need the frequency of executing its class Foo
.
download and cache
can be frozen, so you will not need an example, but you can call StartCoroutine
without a monobahavier example will not work.
Comments
Post a Comment