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 Caiuse · Oct 31, 2011 at 10:04 AM · iosassetbundlesbuildpipeline

Trouble building AssetBundle database for iOS

I'm trying to create a AssetBundle database for iOS but I'm having problems setting the BuildTarget. The rest of my asset bundles programatically have there BuildTarget set to BuildTarget.iPhone but I'm unable to set the target without making my AssetDatabase unreadable.

The error im getting:

The file can not be loaded because it was created for another build target that is not compatible with this platform. Please make sure to build asset bundles using the build target platform that it is used by. File's Build target is: 6

This is the script in which Im creating the database.

     List<CharacterElement> characterElements = new List<CharacterElement>();

     // As a CharacterElement needs the name of the assetbundle
     // that contains its assets, we go through all assetbundles
     // to match them to the materials we find.
     string[] assetbundles = Directory.GetFiles(CreateAssetbundles.AssetbundlePath);
     string[] materials = Directory.GetFiles("Assets/characters", "*.mat", SearchOption.AllDirectories);
     foreach (string material in materials)
     {
         foreach (string bundle in assetbundles)
         {
             FileInfo bundleFI = new FileInfo(bundle);
             FileInfo materialFI = new FileInfo(material);
             string bundleName = bundleFI.Name.Replace(".assetbundle", "");
             if (!materialFI.Name.StartsWith(bundleName)) continue;
             if (!material.Contains("Per Texture Materials")) continue;
             characterElements.Add(new CharacterElement(materialFI.Name.Replace(".mat", ""), bundleFI.Name));
             break;
         }
     }

     // After collecting all CharacterElements we store them in an
     // assetbundle using a ScriptableObject.

     // Create a ScriptableObject that contains the lis t of CharacterElements.
     CharacterElementHolder t = ScriptableObject.CreateInstance<CharacterElementHolder> ();
     t.content = characterElements;

     // Save the ScriptableObject and load the resulting asset so it can 
     // be added to an assetbundle.
     string p = "Assets/CharacterElementDatabase.asset";
     AssetDatabase.CreateAsset(t, p);
     Object o = AssetDatabase.LoadAssetAtPath(p, typeof(CharacterElementHolder));

     // Build the CharacterElementDatabase assetbundle.
     //BuildPipeline.BuildPlayer( levels, "WebPlayerBuild", BuildTarget.WebPlayer, BuildOptions.None); 
     BuildPipeline.BuildAssetBundle(o, null, CreateAssetbundles.AssetbundlePath + "CharacterElementDatabase.assetbundle");

     // Delete the ScriptableObject.
     AssetDatabase.DeleteAsset(p);

Anyone have any idea what I can do. barring in mind that when I set the BuildTarget in the script above I get a unreadable exception.

Once last thing the way in which im fetching the Bundles is through a WWW download, if that might be some sort of cause.

Cheers - Caius

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
Best Answer

Answer by Caiuse · Nov 16, 2011 at 11:19 AM

Solved, if you run into problem, check and double check the BuildTarget of all the assetBundles.

Comment
Add comment · Show 1 · 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
avatar image JanWosnitza · Aug 08, 2012 at 05:09 PM 0
Share

Exactly as you said: check, double check and triple check hehe thanks ;)

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

ArKit not included in unity.framework on xcode 0 Answers

Loading asset from an asset bundle crashes on ios. 1 Answer

"Real Memory" usage in iOS expands the more often one prefab is referenced in the assetbundle 0 Answers

AssetBundleManager - what asset bundle URL to specify for iOS (Xcode simulator, Testflight, Appstore)? 0 Answers

What does MapFileParser do? 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