Last active
December 13, 2015 21:28
-
-
Save tsubaki/4977554 to your computer and use it in GitHub Desktop.
ラムダ式の例その3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Texture mainTexture; | |
delegate void DownloadAction(WWW www); | |
void Start () | |
{ | |
StartCoroutine(DownloadAndAction(textureUrl, (www)=> | |
{ | |
mainTexture = www.texture; | |
})); | |
} | |
IEnumerator DownloadAndAction(string url, DownloadAction act) | |
{ | |
using( WWW www = new WWW(url)) | |
{ | |
while( !www.isDone && string.IsNullOrEmpty(www.error)) { | |
yield return null; | |
} | |
if( act!=null) | |
act(www); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment