x


Download resources to the iphone doesnt work...

Hi,

im testing to load external resource data from my server in my unity-iphone-app . If i run that script on the mac, it works great. But if i build the unity-iphone-app, it doesnt work and i get an "SIGBUS" error in xcode. Ive read that this is a null reference. But what is wrong? Would be great to have a look. Thanks

private var asset : GameObject;
public var link  : String = "http://myserver.com/unity/prefab_resource.assetBundle";


private var download : WWW;
private var assetbundle : AssetBundle;


function OnGUI()
{
    if(download == null){
    	if(GUILayout.Button("Load prefab")){ 
    		StartDownload(link);
    	}
    }
    else{
    	if(download.error == null){
    		var progress : float = parseInt(download.progress * 100);
    		GUILayout.Label(progress + "%");

    		if(download.isDone && GUILayout.Button("Unload Resource")){
    			download.Dispose();
    			download = null;
    			assetbundle.Unload(true);
    			assetbundle = null;	
    			Destroy(asset);
    		}
    		else{
    			GUILayout.Label(download.error);	
    		}

    	}
    }	
}

function StartDownload(url : String){
    download = new WWW(url);
    print(download.url);
    yield download;

    asset  = Instantiate(download.assetBundle.mainAsset);
    assetbundle = download.assetBundle;
}
more ▼

asked Feb 05 '10 at 02:16 PM

yosh gravatar image

yosh
901 73 81 94

(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

If you press continue in the Xcode debugger and check the console you can see the error. When loading iPhone assests make sure you built them with iPhone unity not regular unity. I have done sucessful asset downloads to iPhone like this.

more ▼

answered Feb 05 '10 at 02:30 PM

Ryuuguu gravatar image

Ryuuguu
454 13 18 29

Oh thanks. I didnt knew that already. Heres my console-output: "Wake up 3G/EDGE - start. Wake up 3G/EDGE - end. You are trying to load data from a www stream which had the following error when downloading. Couldn't resolve host 'myserver.com/xyz' (Filename: /Users/build/builds/unity-iphone-1.5/iphone-1.1/Projects/../Runtime/Export/WWW.cpp Line: 745)"

Like you said, i built them with the unity-iphone-editorscript to create these assets. Ive tested it additional as a webplayer, there it works. Ive got full cellwork-signal, so it should work. What else could it be?

Feb 05 '10 at 02:45 PM yosh

There is something wrong either with URL you passed to the WWW class, either with your networking setup on device. WWW was unable to resolve your server IP : "Couldn't resolve host 'myserver.com/xyz'"

Feb 06 '10 at 11:00 AM Mantas Puida

Oh, yeah. Thats right. Ive uploaded my file to another webserver, now it works. That testserver ive used, isnt reachable from outside the network i use. I didnt know that. Thanks a lot.

Feb 08 '10 at 12:38 PM yosh
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2000

asked: Feb 05 '10 at 02:16 PM

Seen: 2910 times

Last Updated: Feb 05 '10 at 02:16 PM