Log in or register to post comments

downloading scene asset bundles dynamically

March 8, 2012 - 12:26am #1

Has anyone been able to get this to work? I've tried it on an Android phone. I've downloaded the scene by using LoadFromCacheOrDownload and that bit works. My scene will run but it doesn't do any tracking. I know its running 'cos i have some code to make a HUD and the camera turns on.

Re: downloading scene asset bundles dynamically

March 14, 2012 - 11:35pm #8

OMG Stefan, you have just made my day with that news!! I am now on my knees crying tears of relief...lol If you're a Unity developer you know how hard it is to get an app under 20MB after Unity adds its code then Apple adds more stuff before putting it in the app store.

As for dynamically loading DLLs onto your iPhone, its strictly forbidden by the Apple TOS. No code in binary, intermediate language or even plain text script allowed. This is why Flash was forbidden. This would enable people to download apps without going through the app store. Even if you could pull it off and get an app in the app store, it would be removed later and your developer license revoked. If I'm wrong, or there is a workaround then I would be delighted to know! Alas, I did spend days scouring the forums to no avail

Re: downloading scene asset bundles dynamically

March 13, 2012 - 8:06am #7

Check Unity Answers. Apparently developers have been able to render their scripts as a dll using Mono, and then load these at runtime. There's mention of this method being used successfully on Android, though not iPhone.

Re: downloading scene asset bundles dynamically

March 13, 2012 - 6:00am #6

i've been searching for a way to dynamically load scripts in unity but i haven't been successful so far. if someone finds an easy way i would be very interested too.
about the file size limit, as far as i know the limit is 50mb for iOS and android now.
See android and iOS.
best,
stefan

Re: downloading scene asset bundles dynamically

March 13, 2012 - 3:47am #5

I can't include my scripts if I haven't created them yet. I was hoping to have an app already out then be able to load new AR sequences that I create in the future. This also gets around the 20MB limit. Would be sweet if you can just download the base app from the app store (under 20MB) then it downloads the sequence when needed.

Re: downloading scene asset bundles dynamically

March 11, 2012 - 8:29am #4

Can you not include your scripts w/ the installation?

Re: downloading scene asset bundles dynamically

March 9, 2012 - 7:42pm #3

well apparently its not possible to bundle up your scripts in the scene because scripts need to be pre-compiled. Also you can't pre-compile them into binaries and download that onto iPhone because Apple doesn't allow binaries to be downloaded dynamically (and bypassing the app store). Dammit! But if anyone knows a workaround do tell please.

Re: downloading scene asset bundles dynamically

March 8, 2012 - 12:41am #2

blerh, i was using the wrong trackable. ok, that was embarrassing!

to redeem myself I'll post up my code on creating a menu item for the Unity editor that allows you to create scene bundles. You need to have the scene NOT selected in the Build Settings if you want it included in the bundle

using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;

public class buildbundle : EditorWindow {

[MenuItem("Assets/Build AssetBundle")]

static void Init() {
string path = EditorUtility.SaveFilePanel ("Save Scene", "", "New scene", "unity3d");
if (path.Length != 0) {
buildit (path);
}
}

static void buildit(string path) {
List Levels = new List();
EditorBuildSettingsScene[] Scenes = EditorBuildSettings.scenes;

foreach(EditorBuildSettingsScene Scene in Scenes) {
if (!Scene.enabled) {
Levels.Add(Scene.path);
}
}
if (Levels.Count > 0) {
BuildPipeline.BuildStreamedSceneAssetBundle( Levels.ToArray() , path, EditorUserBuildSettings.activeBuildTarget);
}
}
}

Log in or register to post comments