728x90
Assets 상위 경로를 접근
Application.dataPath 를 사용하여 기본 경로를 가져온다
타겟 디바이스 마다 경로가 다르기 때문에 확인 후 사용
[ https://docs.unity3d.com/ScriptReference/Application-dataPath.html ]
본 글은 상위 폴더에 output 폴더 생성을 위하여 사용
using System.IO;
public class GetPath : MonoBehaviour
{
public string path;
void Start()
{
path = Application.dataPath;
string newPath = Path.GetFullPath(Path.Combine(path,@"../"));
Debug.Log(newPath);
}
}
반응형
'programming > unity' 카테고리의 다른 글
tip - [field: SerializeField] [SerializeField] 차이 (0) | 2022.11.10 |
---|---|
tip - visual studio for Mac 삭제 및 vscode 셋팅 (0) | 2022.08.05 |
error - Visual Studio와 Unity 연동 문제 해결 (2) | 2021.01.05 |