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 Infrid · Jul 05, 2013 at 03:31 AM · assetbundleasset

problem creating assetBundle : size is way too small

I've implemented the script to export a prefab as an asset bundle as described here : http://docs.unity3d.com/Documentation/Manual/iphone-Downloadable-Content.html

However, the resulting filesize is like 4kb; but my prefab should be about 1mb minimum, so clearly the asset is exporting badly.

What could be wrong? Documentation for this feature (which is pro, no less) is really really lacking.

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
0

Answer by Jashengmato · Sep 10, 2013 at 01:41 AM

Update:

Turns out ScriptableObject used a lot of disk space, there is an other way out:

 string path = UnityEditor.AssetDatabase.GetAssetPath(objectToBuild) ;
 UnityEditor.AssetDatabase.CopyAsset(path, "Assets/"+objectToBuild.name+".bytes") ;

Duplicate the object and rename it with ".bytes" extension, pack those .bytes files into assetBundle, then delete 'em.

Note that files in assetBundle are accessing without the extension name, so create the bundle with .bytes copy will do no harm.


In this page unity documented as following: "If you want to include files with custom binary data, they should have the extension ".bytes"."

I tied to export a txt file which changed extension to "sdta". The size was 176 bytes.

Then export 10 sdta file, bundle size increased to 180 bytes.

It does exported, but not in the right way.

I think custom typed Object just exported reference data but not the file data.

So, all we need to do is export the file using ScriptableObject like this:

 public class BytesHolder : ScriptableObject
 {
     public byte[] dataBytes ;
     
     public static BytesHolder GetHolderObject(string path)
     {
         //    Check file exist 
         //    read file length and create bytesHolder object
         //    read data
         //    return
     }
 }

When building the bundle, use BuildPipeline.BuildAssetBundleExplicitAssetNames and specify the name of that object.

Export ScriptableObject like this:

 BytesHolder holder = BytesHolder.GetHolderObject("foo path");
 AssetDatabase.CreateAsset(holder, "Assets/objects_names.asset");
 //  Export
 AssetDatabase.DeleteAsset("Assets/objects_names.asset") ;

Just figure this out, will give it some test and post further detail.

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

16 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

Related Questions

How to save assets fast (AssetDatabase.CreateAsset) 0 Answers

How to remove an asset package 1 Answer

AssetBundle Load 0 Answers

Addressables - Use Asset Database (faster) - Not loading assets within a folder 1 Answer

How to Load Asset Bundle on 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