Log in or register to post comments

how to make that AssetsBundles downloaded Fail on when the target find?

December 25, 2012 - 2:13am #1

 

Hello, I have a problem with downloading files via AssetsBundles. I downloaded the file in the Target AssetsBundles (prefab from script format unity3d), everything is loaded properly. But the problem is that the Target Fail loaded as soon as I start the application, ie not on when the target with how to make that AssetsBundles downloaded Fail on when the target has?

Here is a script through which I download file:
using UnityEngine;
using System.Collections;

public class LoadAssetBundle : MonoBehaviour {

public WWW www;
public string url = "Cube.unity3d";
public string resourcePath = "Cube";
public int guiOffset = 20;
public AssetBundle assetBundle;
public Object instanced;

private GameObject go;
private int progress;

public LoadAssetBundle()
{
}

// Use this for initialization
IEnumerator Start()
{
// Start a download of the given URL
www = WWW.LoadFromCacheOrDownload(url, 1);

// Wait for download to complete
yield return www;

// Load and retrieve the AssetBundle
assetBundle = www.assetBundle;

// Load the GameObject
//go = assetBundle.Load("mainAsset", typeof(GameObject)) as GameObject;
go = (GameObject)assetBundle.mainAsset;

// Instantiate the GameObject
Instantiate(go);

GameObject goImageTarget = GameObject.Find("ImageTarget2");
GameObject goAk47 = GameObject.Find("Ak47(Clone)");
goAk47.transform.parent = goImageTarget.transform;
goAk47.transform.localPosition = new Vector3(-0.01544512f, 0.5530834f, -0.8900945f);
goAk47.transform.localScale = new Vector3(0.03025189f, 0.03025189f, 0.03025189f);

}

// Update is called once per frame
void OnGUI()
{
GUILayout.Space(guiOffset);
progress = (int)(www.progress * 100);
GUILayout.Label("download: " + progress + "%");
}
}

Asset bundles cannot contain Image Targets

December 27, 2012 - 3:38am #2

Hi,

I think others have tried this and found that it does not work.

Please see this thread: https://developer.vuforia.com/forum/unity-3-extension-technical-discussion/assetbundles-not-working-qcar-imagetarget

..for discussion and alternatives.

Essentially what you need to do is download the .dat and .xml files and instantiate these directly.

HTH

N

Log in or register to post comments