IEnumerator GetColorsFromImageOnWeb(string url) { WWW www = new WWW(url); yield return(www); byte[] imageData = www.bytes; Texture2D texture = new Texture2D(2, 2); texture.LoadImage(imageData); GetComponent <Renderer>().material.mainTexture = texture; colors = texture.GetPixels(0, 0, texture.width, texture.height); Debug.Log(colors[0].r); ConvertColorsToColors32(); SetColorAverages(); creatureSpawn.Spawn(); //Okay, putting this here violates SOLID principles a little, but it makes everything easier //yield return null; }
private static void Sample1() { SpawnCreature.Spawn("Orc"); SpawnCreature.Spawn("Troll"); }