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!

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;
}

Try AssetDatabase

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