Skip to content

Instantly share code, notes, and snippets.

@deathponta
Created September 26, 2018 11:03
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 deathponta/13300a71a5ca369b460276ef5f612538 to your computer and use it in GitHub Desktop.
Save deathponta/13300a71a5ca369b460276ef5f612538 to your computer and use it in GitHub Desktop.
【Unity】右クリックしたオブジェクトのフルパスをクリップボードにコピーする
using UnityEngine;
using UnityEditor;
public class CopyAbsolutePath : MonoBehaviour {
[MenuItem("Assets/絶対パスをクリップボードにコピー", false)]
static void Execute()
{
// get select GO full path
int instanceID = Selection.activeInstanceID;
string path = AssetDatabase.GetAssetPath(instanceID);
string fullPath = System.IO.Path.GetFullPath(path);
// copy clipboard
GUIUtility.systemCopyBuffer = fullPath;
Debug.Log("Copy clipboard : \n" + fullPath);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment