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
4
Question by N1nja · Jul 09, 2010 at 10:30 PM · assetcustom

Custom Asset Files

I've seen that the Terrain System was able to create its own Terrain Asset, it even has its own Icon, this asset can then be selected from an ObjectField in the inspector, and loaded. Any idea how this is done, and how I might replicate it?

I've been looking around the forums, and answers board for a while.. but I can't find any leads.

Hope someone can help, and thanks a lot if you do!

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

3 Replies

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

Answer by jashan · Aug 05, 2010 at 12:28 PM

I think what you're looking for is ScriptableObject. When you implement ScriptableObject you can create instances of those objects via editor scripts and use those objects e.g. for storing data.

I'm using this, for example, to store meta information about my levels persistently as objects in the project. Here's a script snippet I used to create those assets ("LevelData" is a ScriptableObject).

[MenuItem("LevelEditor/Create Level Data")]
public static void CreateLevelData() {
    LevelData asset = new LevelData();  //scriptable object
    AssetUtility.CreateAsset(asset, "LevelData New");
    AssetUtility.SaveAsset(asset);
    EditorUtility.FocusProjectWindow();
    Selection.activeObject = asset;
}
Comment
Add comment · Show 6 · 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 N1nja · Aug 24, 2010 at 04:13 PM 0
Share

thanks, this will do =]

avatar image Leolicos.du · Aug 02, 2011 at 05:02 PM 0
Share

What is AssetUtility? I've searched all over for it and I can't seem to find it anywhere. AssetDatabase seems to have the same functions, but it won't let you create an asset that isn't native to Unity. I'm trying to do the same thing here, except I'm trying to load a custom file type (.custom for example)

avatar image zharramadar · Jan 14, 2012 at 05:18 PM 0
Share

That does not work anymore, anyone can give feedback on how to do this in Unity 3.5?

avatar image Avaista · Jun 27, 2012 at 11:42 AM 2
Share

http://unity3d.com/support/documentation/ScriptReference/AssetDatabase.CreateAsset.html says you need to use the appropriate extension

avatar image equalsequals · Aug 17, 2012 at 02:26 PM 0
Share

'.asset' is the extension for arbitrary serialized objects.

Show more comments
avatar image
0

Answer by jeffpk · Jun 12, 2012 at 11:17 PM

Try AssetDatabase

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

Answer by maccesch · Aug 13, 2014 at 09:30 PM

Please have a look at this blog post: http://80hdgames.com/chris/?p=100

They're using this script: http://www.jacobpennock.com/Blog/?page_id=715

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

6 People are following this question.

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

Related Questions

Is it possible to reference a custom file type in the inspector? 1 Answer

Custom Inspector when Selecting from Project Tree? 0 Answers

Adding custom metadata when importing an asset 1 Answer

Where am I put 3d models in my custom unity package 2 Answers

Unity editor and inspector header 0 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