Dose assetbundle work on iPodTouch?

Hello everyone,

I’m composing a character customize program run on mobile devices, using assetbundle.
I set BuildTarget.Android to generate assetbundles for android phones and it works pretty well.
Then I use the same editor code, only change build target to be BuildTarget.iPhone, to generate assetbundles for iOS, but it never works on my iPodTouch.

The test iPodTouch is 2nd gen, software version 4.2.1. wifi access works fine.
seems the WWW request reached isDone with no error, but the www.assetBundle turned out to be null.

Same source, loading different assetbundle by setting BuildTarget.Android/iPhone. I think it should get work. (If I was wrong please correct me.)

or, assetbundle does not work on iPodTouch at all?

Hi, welcome to the forum!

Are you using the WWW class to access a webserver or the local filesystem with a file:// URL? If you are accessing the web then do other web based apps (eg, Safari) work OK on the iPod?

sure that the asset bundle was built for iOS. you can’t use desktop ones.

the editor though already would fire an error in the console in such a case on an iOS project

Hi, andeeee
Thank you! I’m a really beginner.

I’m using the WWW class to access a webserver through wifi, part of the source as bellows

www = new WWW("http://192.168.xx.xxx/ios/character.assetbundle");
if(www.error != null){
	traceinfo += "error:" + www.error;
	return false;
}
if(!www.isDone)
	return false;

traceinfo += "isdone ";
traceinfo += " 1. " + (database.assetBundle == null);
traceinfo += " 2. " + (database.assetBundle.mainAsset == null);

I use the variable traceinfo to display informations OnGUI ('cause I don’t know how to make breakpoint work when running on devices…)
and traceinfo shows: isdone 1.True

when Safari access the same url it reached there, although get a “file cannot be downloaded” popup. if the server not running or have no enough authority it should be a Forbidden Error or something like that, isn’t it? I guess.

Hi Dreamora

Yes I think I did make it for iOS, like

BuildPipeline.BuildAssetBundle(characterPrefab, null, path, BuildAssetBundleOptions.CollectDependencies, BuildTarget.iPhone);

other part of the editor source is just the same as use for android.

for using them, the url retrieve part is like

if(Application.platform == RuntimePlatform.Android){
         // get the ones made with BuildTarget.Android
	return "http://192.168.xx.xx/android/character.assetbundle";  
}else if(Application.platform == RuntimePlatform.IPhonePlayer){
         // get the ones made with BuildTarget.iPhone
	return "http://192.168.xx.xx/ios/character.assetbundle";
}

Is there anything to do with path when creating them?

Execution doesn’t get paused while the WWW object downloads the data in order to avoid long pauses in gameplay. It’s advisable to yield the WWW object (as in the example on the WWW class manual page) to make sure it has time to download the data without holding up execution. Another option is to keep polling the isDone variable in a loop but this can make the game seize up for as long as it takes the server to respond.

Thanks for your advice, andeeee.

Actually I’m not quite sure about the difference between yield after a new WWW and return till www instance !null&isDone in Update(). So far as to my tries they seems act the same. But according to your advice and the documentation the yield one could be recommendable, if I don’t make any misunderstanding. ok I’m going to check more.

And, as to this iPodTouch Not Work issue, I think I found what’s wrong :frowning: I did it like this, which I never mentioned since I thought it would be with no matter…
I created assetbundles on macA and built application on macB, that’s why it wont work.
assetbundles created on macA act perfect on macA built applications, the same to macB. (perhaps due to some hardware spec difference? I don’t know…)

(So why I do it like this?..'cause android advance is only available on macA and provisions files only available on macB. Both A and B are using Unity pro trials which is going to expire next week. Good news is my boss finally signed the quote!:smile:)