Last active
March 8, 2016 14:08
-
-
Save tsubaki/347e57ee747a3dfbfa28 to your computer and use it in GitHub Desktop.
GetMyScriptableObjectを見つけ出す
This file contains 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
using UnityEngine; | |
using System.Collections; | |
using UnityEditor; | |
public class GetMyScriptableObject { | |
[MenuItem("Assets/FindMyScriptableObject")] | |
static void Find() | |
{ | |
var guids = UnityEditor.AssetDatabase.FindAssets ("t:MyScriptableObject"); | |
if (guids.Length == 0) { | |
throw new System.IO.FileNotFoundException ("MyScriptableObject does not found"); | |
} | |
var path = AssetDatabase.GUIDToAssetPath (guids [0]); | |
var obj = AssetDatabase.LoadAssetAtPath<MyScriptableObject> (path); | |
Debug.Log (obj.Message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment