Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by RanjithSoman · Mar 29, 2017 at 01:32 PM · androidassetbundlevuforiaunitypro

Assetbundle loads in editor but not when built onto android

I am using unity3d 5.5.2f1 and vuforia 6.2 sdk. I have built asset bundles for android and uploaded it to my server. I am using vuforia to detect markers and then attach the asset bundle to the marker. The script works well in the editor. However after building it and running on the android, it doesn't work. I checked whether its problem with vuforia by attaching another game object to the target. That one appears while on editor and on phone. However only gameobject is getting attached after building on to android and not the assetbundle. link text

 using System;
 using UnityEngine;
 using System.Collections; 
 using Vuforia;
 public class Loadmyasset : MonoBehaviour, ITrackableEventHandler 
 {
     public string AssetName;
     public int Version;
     private GameObject mBundleInstance = null;
     private TrackableBehaviour mTrackableBehaviour;
     private bool mAttached = false;
     public string BundleURL;
 
     void Start()
     {
         StartCoroutine(DownloadAndCache());
         mTrackableBehaviour = GetComponent<TrackableBehaviour>();
         if (mTrackableBehaviour)
         {
             mTrackableBehaviour.RegisterTrackableEventHandler(this);
         }
     }
     IEnumerator DownloadAndCache ()
     {
 
         // Wait for the Caching system to be ready
         while (!Caching.ready)
             yield return null;
         BundleURL = "http://rksunityftpserver.x10host.com/assetbundle/Android/tree.unity3d";
         // Load the AssetBundle file from Cache if it exists with the same version or download and store it in the cache
         using (WWW www = WWW.LoadFromCacheOrDownload (BundleURL, 1))
         {
             yield return www;
             if (www.error != null)
                 throw new Exception("WWW download had an error:" + www.error);
             AssetBundle bundle = www.assetBundle;
             if (AssetName == "")
                 Instantiate(bundle.mainAsset);
             else
                 Instantiate(bundle.LoadAsset(AssetName));
             // Unload the AssetBundles compressed contents to conserve memory
             bundle.Unload(false);
 
         } // memory is freed from the web stream (www.Dispose() gets called implicitly)
     }
 
     public void OnTrackableStateChanged (TrackableBehaviour.Status previousStatus, TrackableBehaviour.Status newStatus)
     {
         if (newStatus == TrackableBehaviour.Status.DETECTED || newStatus == TrackableBehaviour.Status.TRACKED || newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED) 
         {
             
             if (!mAttached && mBundleInstance) {
                 // if bundle has been loaded, let's attach it to this trackable
                 mBundleInstance.transform.parent = this.transform;
                 mBundleInstance.transform.localScale = new Vector3 (10.0f, 10.0f, 10.0f);
                 mBundleInstance.transform.localPosition = new Vector3 (0.0f, 0.15f, 0.0f);
                 mBundleInstance.transform.gameObject.SetActive (true);
                 mAttached = true;
             }
         
         }
     }
 }

Please help me on this

@ZeFirestarter

loadmyasset.txt (2.2 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Honorsoft · Nov 24, 2017 at 01:38 AM

I am getting a similar problem when building for PC. The asset bundle works perfectly in the Editor, but any *.exe builds just hang and won't load any assets. I am new to asset bundles, but am using the Unity AssetBundle tutorial. Can anyone help?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

163 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Android Vuforia dosen't download the asset bundle form a server 0 Answers

URGENT - Loading a scene from asset bundle - Android 0 Answers

AssetBundle.LoadFromFile cause Inflate Error: (file zip crc32 : 00000000) (result: fffffffb) 1 Answer

Android and AssetBundle LoadFromFile 1 Answer

Please Help !!!!!! Baked lightmaps does not work with asset bundle on Ios and Android builds 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges