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 Minorukun · May 28, 2016 at 01:14 PM · importassetcustommetadata

Adding custom metadata when importing an asset

Hi,

I've been wondering if I can set custom metadatas when I import an asset. I'd like to add some info about my music tracks.

Is it possible ?

Thanks :)

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 DiegoSLTS · May 28, 2016 at 03:01 PM

Well, the other day I had the same question and found 2 things:

  • You can write your own custom asset importer: http://www.sarpersoher.com/a-custom-asset-importer-for-unity/

  • You can add your own "userData": http://docs.unity3d.com/ScriptReference/AssetImporter-userData.html

I've not tested any of that, but I guess that's the way you add your own info to metadata files.

Comment
Add comment · Show 4 · 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 Minorukun · May 28, 2016 at 04:20 PM 0
Share

Thank you for the reply.

I've some trouble getting it to work though. I've created a class extending AssetPostprocessor and changed the userData of the .meta file here. That worked, but I have 2 problems :

  1. I can't find how to create a custom editor letting me change the userData in the inspector.

  2. I can't find how I can access the userData of my asset from scripts.

Do you have any idea ?

Thanks again!

avatar image Minorukun · May 29, 2016 at 01:22 PM 0
Share

Quick update : I found that I can get the metadata of an asset this way :

AudioImporter importer = (AudioImporter)AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(my$$anonymous$$usic));

string data = importer.userData;

I've still some trouble extending AudioImporter's inspector.

avatar image DiegoSLTS Minorukun · May 29, 2016 at 03:48 PM 0
Share

Found this: http://answers.unity3d.com/questions/261446/custom-inspector-when-selecting-from-project-tree.html

But it works only with ".asset" assets... $$anonymous$$aybe you can rename your files with assetimporter?

avatar image Minorukun DiegoSLTS · May 31, 2016 at 11:55 AM 0
Share

I ended up following using EditorWindow, as advised here : http://answers.unity3d.com/questions/55722/custom-inspector-element-on-texture-importer.html

I also tried that : http://forum.unity3d.com/threads/custom-textureimporterinspector.260833/

But despite the fact that the inspector displayed correctly the original AudioImporterInspector, the checkboxes were unresponsive, so I gave up.

Thanks anyway, I appreciate the help :)

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Unity Pro re-imports everything on launch 1 Answer

How do I load the assets from a tutorial? 2 Answers

Custom Fonts... Missing on friend's computer 1 Answer

Material tiling on imported fbx model doesn`t fit 0 Answers

how to make assets and textures from quixel bridge look like in 3d preview from bridge 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