• 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 komorra86 · Jun 26, 2014 at 04:01 PM · editor-scriptingprefabsserializationassetsfiles

How to use custom file types as Unity assets

I would to know if it is possible to have following custom features reachable from creating some scripts that will extend Unity editor:

  • custom file extension / file type, that will be handled by editor

  • accessibility to thumbnail of that asset, that is displayed in project window

  • dragging t$$anonymous$$s asset to the scene as a full prefab ($$anonymous$$erarchy of game objects), so I can say the asset should be a prefab type in its inside.

In my case an asset should represent generally a gameobject with some c$$anonymous$$ld gameobjects, where main gameobject should have mesh renderer and mesh filter to display model and c$$anonymous$$ld gameobjects should contain only box colliders and rigid bodies components.

How to ac$$anonymous$$eve that?

I know that according to Unity editor, each prefab parts (components) must have assets that are imported to the project.

It is possible to have one file, that Unity will deal with like pack of prefab that can be dropped into scene, and corresponding assets - in one file?

How generally start work with t$$anonymous$$s issue? What classes / attributes of Unity API will be useful here? Some help will be appreciated :)

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
2

Answer by Paulius-Liekis · Jun 27, 2014 at 05:49 PM

Strictly speaking Unity doesn't support custom asset/file types, but there are ways to fake it.

First of all look into AssetPostprocessor class and more specifically into OnPostprocessAllAssets (http://docs.unity3d.com/ScriptReference/AssetPostprocessor.OnPostprocessAllAssets.html). It gets called when any files change in project folder. I t$$anonymous$$nk that applies to custom files too. So what you can do is listed to OnPostprocessAllAssets and when that is called and there is your file-extension on the list then you generate your prefab from the file. So your file and prefab will be two separate assets in the project view, but that gets you close enough to having automated pipeline.

Some info regarding icons, although I'm not sure it answers your question: https://docs.unity3d.com/352/Documentation/Manual/GizmoandIconVisibility.html http://answers.unity3d.com/questions/7983/changing-the-inspector-titlebar-icon-and-text.html

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

23 People are following this question.

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

Related Questions

Editing prefab fields from custom editor that are not automatically serialized 0 Answers

Using groups of prefabs between projects 1 Answer

How can I load an custom file from the Assets folder? 2 Answers

Undo.RecordObject is too slow on large arrays, alternatives? 1 Answer

SerializedProperty and PropertyField NullReference 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