Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Custom extension for ScriptableObjects

Discussion in 'Scripting' started by elmar1028, Jul 20, 2017.

  1. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,355
    Hi guys,

    How do I specify my own extension for ScriptableObjects? By default it's a ".asset" extension, but my project has different ScriptableObject formats so having unique extensions would make it easier to distinguish between them.

    Any idea on how to approach this kind of situation?

    Thanks!
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,670
    They will always have a .asset extension. What about giving them different filenames? For example monster_*.asset, item_*.asset, spell_*.asset, etc.
     
    elmar1028 and LiterallyJeff like this.
  3. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,355
    That's what I would do if there would be no solution :p
     
  4. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    Or even better - just put them in different folders......
     
  5. JoshuaMcKenzie

    JoshuaMcKenzie

    Joined:
    Jun 20, 2015
    Posts:
    916
    or give them asset labels...
     
  6. The_Dogg

    The_Dogg

    Joined:
    Apr 6, 2017
    Posts:
    4
    create asset with specific file extension inside custom inspector using EditorGUILayout.ObjectField; DefaultAsset; Open/Save dialog
    detail video how do it