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
1
Question by FunnyRobot · Jan 18, 2010 at 08:52 AM · editoreditor-scriptingassetdatabase

How to identify an asset?

Hello. I have a following problem: 1) There can be many asset objects contained in the same file, so LoadAllAssetsAtPath returns multiple objects for one file. 2) After restarting Unity those objects seem to get new Instance IDs, so those are not persistent. 3) There can be multiple objects with the same type/name within a file. So the question is: how do I conclusively identify asset object as the same one I've worked with in previous Unity session?

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

Answer by Lucas Meijer 1 · Jan 18, 2010 at 09:29 AM

Could you describe on a bit higher level what you're trying to achieve? Internally the different objects in an assetfile have a identifier number, however we don't expose that currently (as that gives us the freedom to change how we identify them, which we actually do from time to time). You can use a combination of UnityEngine.Object.name and the result of GetType(). The only type of asset that I can imagine where you'd run into this problem would be imported 3d models / prefabs. In those cases, you could write an AssetPostProcessor, that does something to the objects before they're written to disk that would make them more easily identifyable. Changing the name would be a likely candidate. If we're talking about gameobjects, you could at this point also add a custom monobehaviour that could carry an identifying string. Again, it's a bit difficult to give solid advice without knowing what you're trying to actually do.

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
-1

Answer by Ashkan_gc · Jan 18, 2010 at 02:03 PM

i think the best way is to create an special component that holds unique information about each gameobject. you can generate your own IDs and version and ...

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

Could not load copied asset via AssetDatabase.LoadAssetAtPath 4 Answers

Error using ImportAssetOptions.ForceSynchronousImport 2 Answers

Load an asset right as it is imported? 0 Answers

ObjectField Get object type(Asset, Scene Object) 2 Answers

Is there a way to get a unique hash for an asset? 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