Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
【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
You can’t perform that action at this time.