Skip to content

Instantly share code, notes, and snippets.

@tsubaki tsubaki/Lambda_Test2.cs
Last active Dec 13, 2015

Embed
What would you like to do?
ラムダ式の例その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
You can’t perform that action at this time.