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 deus_duke · May 05, 2012 at 01:19 PM · assetimportingfile-io

Intercept file import

Is it possible in Unity to override / add to the default automatic asset import behavior? I would like to add custom behavior to the way that Unity handles Modo lxo files. Ideally I would like to be able to completely take over the import procedure for certain lxo files that the user could specifies.

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
2

Answer by Bunny83 · May 05, 2012 at 01:30 PM

You might be able to use AssetPostprocessor.OnPostprocessAllAssets. If it's not a supported asset type it is usually recognised as "TextAsset" so you can access it as binary data. If you want a custom inspector for the asset itself you could try to implement your own editor for TextAsset (so you replace the old TextAssetInspector which is an internal class).

I never tried something like that. I'm also not sure if Unity will treat such assets as TextAssets but if it does it should work.

edit
I'm pretty sure that you can't create your own assettype. Unity can't handle that in their assetdatabase.

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 deus_duke · May 06, 2012 at 07:37 PM 0
Share

$$anonymous$$odo is one of the supported packages, and lxo is an accepted asset type to Unity. I am trying to override the default behavior for these particular types of asset in Unity. I believe what you have given me is enough to accomplish my goal, thanks!

avatar image Bunny83 · May 06, 2012 at 08:20 PM 0
Share

Sorry, I'm not an artist and I've never come across a lox file ;) So it's basically just a model. Unity uses the collada exporter of modo since Unity only supports ".FBX, .dae, .3DS, .dxf and .obj"

$$anonymous$$odel assets are fully processed by an AssetPostprocessor so you can change anything afterwards.

$$anonymous$$eep in $$anonymous$$d that Unity doesn't use the asset itself. $$anonymous$$odel-assets are represented be it's importer. The importer will create sub assets (which are stored in the library folder in the assetdatabase). Those sub assets are usually the mesh data as seperate $$anonymous$$esh, the bone hierarchy as a GameObject tree and animations as anim assets.

You can add your own stuff as sub assets to any kind of asset via AssetDatabase.AddObjectToAsset. But like stated in the docs when you reimport the asset such sub assets will be lost.

avatar image deus_duke · May 07, 2012 at 02:21 AM 0
Share

Oh so is it not possible to tell Unity not to import anything from the lxo at all? $$anonymous$$y goal is to mark certain assets to not be imported by Unity but to defer all processing to my script, which will process the file.

avatar image Bunny83 · May 07, 2012 at 03:15 AM 0
Share

No that's not possible. You could rename the file to .txt so it's just a text asset and Unity won't do any processing with it, but you can read the content in an editor script. See TextAsset

avatar image
0

Answer by deus_duke · May 07, 2012 at 04:35 AM

Ah that's different then what I had in mind but it works. Thanks for all your help!

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Import Project from Asset store 6 Answers

Unity Crashes when importing any asset package 0 Answers

How do you change an asset's import settings at creation? 0 Answers

How do you make blender models mesh colliders work right? 1 Answer

Direct Blender importing 4 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