Created
January 28, 2019 01:43
-
-
Save beardordie/f965daa73514b42c741e9b43ca74d39e to your computer and use it in GitHub Desktop.
Click-to-assign a name field from a Scriptable Object's filename (requires Odin Inspector)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[InlineButton("AutoName", "Auto")] | |
public new string name; | |
public void AutoName() | |
{ | |
#if UNITY_EDITOR | |
string assetPath = UnityEditor.AssetDatabase.GetAssetPath(GetInstanceID()); | |
name = System.IO.Path.GetFileNameWithoutExtension(assetPath); | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment