Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Last active December 13, 2015 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/4977554 to your computer and use it in GitHub Desktop.
Save tsubaki/4977554 to your computer and use it in GitHub Desktop.
ラムダ式の例その3
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