Skip to content

Instantly share code, notes, and snippets.

@yumehachi
Last active December 21, 2015 05:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yumehachi/6259434 to your computer and use it in GitHub Desktop.
Save yumehachi/6259434 to your computer and use it in GitHub Desktop.
Project内のファイルにアクセスするためのUnity Editorスクリプト
using UnityEngine;
using UnityEditor;
using System.Collections;
/// <summary>
/// LoadAssetAtPath Test
/// </summary>
/// <author>
/// Create by yumehachi on 2013/08/18
/// </author>
public class SelectFile : Editor
{
[MenuItem ("TestScript/SelectPrefab")]
static void SelectPrefab ()
{
//拡張子まで書く
string path = "Assets/Prefab/Cube.prefab";
Object o = AssetDatabase.LoadAssetAtPath (path, typeof(Object)) as Object;
Selection.activeObject = o;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment