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 /
avatar image
0
Question by Ben 2 · Jan 22, 2010 at 03:29 PM · assetbundleasset

How Can I Uniquely Identify Assets In An Asset Bundle?

I have a situation where I want to load several asset bundles representing the same time of information. This information is structured on the file system (at build time) and converted to an asset bundle by a script. I will load multiples of these asset bundles at a time and I don't want different aspects of the code to worry about which bundle the information is coming from. Instead I will create a class that handles loading the asset from the asset bundles.

So for example each of my asset bundles will have a Config.xml file. If each asset bundle represents a project, I want to fetch the Config.xml for a specific project using a name like "/Project1/Config.xml" to distinguish it from "/Project2/Config.xml".

Is there a way to get a GUID or other long-lived identifier for an asset so that in my build script I can create a mapping from my naming structure for assets to the actual name of the asset accepted by AssetBundle.Load(...)?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Daniel Sperry 2 · Apr 18, 2010 at 06:46 PM

Unity provides the following methods that allow you to uniquely identify asset files:

  • AssetDatabase.GetAssetPath
  • AssetDatabase.AssetPathToGUID
  • AssetDatabase.GUIDToAssetPath (not required by your problem)

If you use an external version control these guids are stored inside the .meta files. A very nice thing is that when you move an asset file inside the editor the guid stays the same, so the artist may move or rename files without breaking your code or database.

Also you may want to use:

  • BuildPipeline.BuildAssetBundleExplicitAssetNames: allows you to circunvent the problem of files with the same name, may also be used to change the asset file name to include the guid, with makes the whole process name safe.
  • BuildPipeline.PushAssetDependencies: allows you to build bundles that share dependencies, very useful to save memory and disk space when working with bundles.

I've done almost the same thing that you described.

I my case I have several bundles and generate a single xml file that describes wich bundle stores wich resource. I also manage bundle and asset dependencies so several bundles may share data. The user loads the assets by Guid.

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
avatar image
0
Best Answer

Answer by andeeee · Jan 25, 2010 at 03:27 PM

There is no long-term UID for objects in Unity. The only thing I can think of that might work is creating some kind of hash from the type and modification time and adding it to the name of the object.

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

No one has followed this question yet.

Related Questions

Memory Locking While Loading Issue 0 Answers

Assets Bundle... in Pro? 2 Answers

Accessing an already loaded Asset Bundle 1 Answer

Where are the built scripts stored in a build? 1 Answer

how to download Asset Bundles from website to Application.dataPath across platforms ? 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