Created
September 26, 2018 11:03
-
-
Save deathponta/13300a71a5ca369b460276ef5f612538 to your computer and use it in GitHub Desktop.
【Unity】右クリックしたオブジェクトのフルパスをクリップボードにコピーする
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 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