programming/unity

unity - Assets 상위 폴더 경로 가져오기

slothCat 2021. 9. 8. 19:25
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);
    }
 }
반응형