Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Last active March 8, 2016 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/347e57ee747a3dfbfa28 to your computer and use it in GitHub Desktop.
Save tsubaki/347e57ee747a3dfbfa28 to your computer and use it in GitHub Desktop.
GetMyScriptableObjectを見つけ出す
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