Image is not loading from the server

Hi,

I am trying to do pull the texture from the server and apply it to my gameobject.

I have used the below code for this function:

private string url = "http://www.camelcitydispatch.com/wp-content/uploads/2013/08/Fire-Hands-Screensaver_1.jpg";

	private WWW www;

	public Material matl;


	// Use this for initialization
	IEnumerator Start () {

		www = new WWW (url);

		yield return www;

		matl.mainTexture = www.texture;

	
	}

this code working fine in the unity editor, but when i export it to the webplayer it is not working. Please tell me how to solve this and how to make it run.

This is the image link:
http://www.camelcitydispatch.com/wp-content/uploads/2013/08/Fire-Hands-Screensaver_1.jpg

Thanks.

Hi there, I think it could be restrictions because of security reason. The Unity webplayer expects a http served policy file named crossdomain.xml to be available on the domain you want to access with the WWW class… see here more information how it using http://docs.unity3d.com/Documentation/Manual/SecuritySandbox.html

but if i use the javascript it is working, in c# only i is showing the problem.

Strange. Code the same in JS and C#?

yes, both coding are same.

So, use JS bro :sunglasses:
I have not the ghost of an idea why it’s happend.

Could it possibly be due to your mainTexture referencing the www.texture and when that coroutine ends the www.texture is removed from memory?

no, it wont remove. it will be on the server itself.