Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
0
Question by xproject2013 · Mar 27, 2014 at 04:57 PM · c#androidassetbundleloadassetatpath

Android texture AssetBundles loading problem

hi everyone, I'm trying to load images from an assetbundles but when I load the texture in the scene the image appear broken, I post the link at the file that I used to see if the problem is caused from some picture settings:

http://dev.x-project.it/bundles/AssetsTest.zip

In the file in the resources folder you can find the original image that i use for create the bundles. I'd like to know if the script that I use for export the bundles for the different device is correct, i post it below.

I cant load the bundle in the editor mode and i don't understand where is the mistake, you can find the script in the "app" gameobject, maybe is only a wrong path setting but i've tried all the possibilities and it doesn't works.

Another big problem is when i execute the "build and run" on Android device (Galaxy Tab 2) the application crashes immediately. in most cases the application when start, immediately minimize in the task bar so i have to reopen it again, sometimes more than one time before it works.

On WebPlayer everything works fine.

Any suggestion? Thanks in advance

 using UnityEngine;
 using System.Collections;
 
 public class ExampleLoadingBundle : MonoBehaviour {
 
     public GUIText label;
     public GUIText urlLabel;
     public GUITexture pic;
 
     public string url; // URL AssetBundle
     public int version = 1; // AssetBundle version
     
     public string assetName; // Name of the Asset to be loaded from the AssetBundle
     public string assetPath; // Path to the Asset in the Project folder
     
     Object ObjInstance; // Instance of the object
 
     string deviceFolder;
 
 
     GameObject obj;
     Texture2D texture;
 
     GameObject objects;
 
 
     void Awake(){
         #if UNITY_WEBPLAYER
         deviceFolder = "webplayer";
         #endif
         #if UNITY_ANDROID
         deviceFolder = "android";
         #endif
         
         url = "http://dev.x-project.it/bundles/" + deviceFolder + "/compositions2.unity3d";
         urlLabel.text = url;
         assetPath = "Assets/Resources/" + deviceFolder + "/compositions.unity3d"; 
     }
 
 
     void Start(){
         StartCoroutine(Download());
     }
 
 
     IEnumerator Download () {
         AssetBundleLoader assetBundleLoader = new AssetBundleLoader ();
         yield return StartCoroutine(assetBundleLoader.LoadBundle <Texture2D> (url, version, assetName, assetPath));
         if (assetBundleLoader.Obj != null) {
 
             texture = Instantiate (assetBundleLoader.Obj) as Texture2D;
             pic.texture = texture;
             //pic.pixelInset.x
             label.text = pic.name + " -- " + pic.pixelInset;
 
             Debug.Log (label.text);
         } else {
             label.text = " Load failed!";
 
             Debug.Log (label.text);
         }
     }
 
 
 }
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

0 Replies

· Add your reply
  • Sort: 

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

20 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

Related Questions

Distribute terrain in zones 3 Answers

Including scripts in AssetBundles on iOS 1 Answer

Multiple Cars not working 1 Answer

In an Addressable system, how to manage multiple profiles with different Remote Load Path without making a new build? 0 Answers

AssetBundles are not working outside editor on PC or Android. 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