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 ChenMo2 · Feb 18, 2013 at 11:42 AM · updateassetbundleresources

About bundle asset and update

Our game is a MMO on PC.When players have installed our game, all resources include meshes, shaders, textures would have been saved on disk.I am a programer, and I am in charge of finishing resources loading and update.

Any given asset in a bundle may depend on other assets. For example, a model may incorporate materials which in turn make use of textures and shaders. It is possible to include all an asset's dependencies along with it in its bundle. However, several assets from different bundles may all depend on a common set of other assets (eg, several different models of buildings may use the same brick texture). If a separate copy of a shared dependency is included in each bundle that has objects using it, then redundant instances of the assets will be created when the bundles are loaded. This will result in wasted memory.

First, I compress each resources into asset bundles like this. Code:

         [MenuItem("BundleAsset/Prefab [Regenerate All]", false, 1)]
         static public void BundlePrefab()
         {
         //    Create folders.
             if (!hasInitialized)
                 Initialize();
     
             BuildPipeline.PushAssetDependencies();
 
         //    Bundle all sub resources
             BundleTexture();
             BundleMaterial();
             BundleModel();
             BundleAudio();
   
             //    Bundle main resources
             BundleObject();
             BundleScenery();
             BundleEffect();
     
             BuildPipeline.PopAssetDependencies();
         }
 
     static private void BundleObject()
     {
         string[] fileNames = Directory.GetFiles(objectPathName);
 
         for (int i = 0; i < fileNames.Length; ++i)
         {
             string fileName = GetFileName(fileNames[i]);
 
             if (IsMetaFile(fileName))
                 continue;
 
             Object obj = AssetDatabase.LoadMainAssetAtPath(fileName);
 
             BuildPipeline.BuildAssetBundle(obj, null, objectBundlePathName + @"/" + obj.name + suffix, BuildAssetBundleOptions.CollectDependencies, targetPlatform);
         }
     }

Trouble is resource update.For example, a desk model depends on a texture named T, when update happens, a chair depends on the same texture T should be added.If I build a chair bundle and a T bundle, and update them, desk's texture will be missing.To solve this program, I must bundle desk, chair and T at the same time and update them.I have to update some resources I don't want to update, it is a trouble, how to solve it ?

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

9 People are following this question.

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

Related Questions

Asset Bundle vs Resources Question 1 Answer

Upgrade asset bundle from Unity 5.5 to Unity 2017.9 0 Answers

AssetBundle including resources that are in Resources folder 0 Answers

How to import the object from server to unity 2 Answers

Data Persistance, Resources and AssetBundles 0 Answers


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