Project Current Directory Info(Project 현재 경로)
프로젝트 브라우저 현재 디렉토리
내부 통합 정적 함수 내부에 숨겨져 ProjectWindowUtil.TryGetActiveFolderPath있으며 액
세스하려면 Reflection 이 필요하다.

<샘플 코드>
using UnityEngine;
using UnityEditor;
using System.Reflection;
// Define this function somewhere in your editor class to make a shortcut to said hidden function
private static bool TryGetActiveFolderPath( out string path )
{
var _tryGetActiveFolderPath = typeof(ProjectWindowUtil).GetMethod( "TryGetActiveFolderPath", BindingFlags.Static | BindingFlags.NonPublic );
object[] args = new object[] { null };
bool found = (bool)_tryGetActiveFolderPath.Invoke( null, args );
path = (string)args[0];
return found;
}
반응형
Custom 을 진행하기 위해서는 내부 소스 코드를 참고하면 꽤나 많은 것들에 대한 아이디어와 활용이 가능하다.
Unity ProjectWindow/ProjectWindowUtil.cs : [링크]
GitHub - Unity-Technologies/UnityCsReference: Unity C# reference source code.
Unity C# reference source code. Contribute to Unity-Technologies/UnityCsReference development by creating an account on GitHub.
github.com
원본 링크 : [링크]
Getting path of right click in unity 3D editor
I want to create an extension for the Unity 3D Editor and have an custom asset type. During the process of creation this I recognized that I would improve the UX/usability if I can specify the path...
gamedev.stackexchange.com
★☆☆☆☆
반응형
'개발 > Unity' 카테고리의 다른 글
| Unity)Animation Curve(애니메이션 커브) (0) | 2023.05.22 |
|---|---|
| Unity Tip) 프로젝트, 하이어라키에서 파일 쉽게 찾기 (Search Filter t: prefab) (2) | 2023.05.16 |
| Unity) Texture2D Resize Code (텍스쳐 2D 사이즈 변경) (0) | 2023.05.10 |
| Unity) PlayerPrefs 저장 경로 (0) | 2023.05.09 |
| Unity) 모바일 딥 링크 설정 - Mobile Deep Link(Android, iOS, UWP) (0) | 2023.05.04 |
댓글