Basic script:
public class Loading : MonoBehaviour {
public GameObject plane;
string [] str = { "http://users.metropolia.fi/~lucasc/texture_1a_by_jakezdaniel-d1b6lmo.jpg",
"http://users.metropolia.fi/~lucasc/texture_34_by_sirius_sdz-d1ihrrm.jpg",
"http://users.metropolia.fi/~lucasc/a1ca03e0ca1cda6ae5ea0e873318a306349c0934.jpg",
"http://users.metropolia.fi/~lucasc/a34290b07559b4e3881f816fe97a3d02f4f2232b.jpg"
};
int index = 0;
void Update(){
if(Input.GetKeyDown(KeyCode.Space)) {
StartCoroutine (StartRoutine());
}
}
IEnumerator StartRoutine () {
WWW wwwTexture = new WWW(str[index]);
yield return wwwTexture;
if(++index == str.Length) { index = 0; }
MeshRenderer meshRenderer = plane.GetComponent<MeshRenderer>();
meshRenderer.material.mainTexture = wwwTexture.texture;
}
}
Using this with a basic cube on scene (nothing else, just drag the cube into the plane slot), then the first two textures loads fine but the third and fourth just keeps coming up with problem. The actual texture gets offset to 0.3 and the remaining 0.6 is filled with either some other textures or some distorsion. Funny it does not happen on all textures.
I guess it might have to do with the nature of those. I filled a bug report but maybe someone has a solution as we would need a quick solution or explanation.
Expected:
What I get:
See the extra purple thingy that should not be there? This problem came up with Unity5 and was working fine on Unity4.