Unity&C#/Unity

data path

리네엔 2023. 9. 25. 23:28

읽기 전용 데이터 경로

string assetsPath = Application.dataPath;

런타임 시에는 외부 파일이나 저장소 경로에 접근할 때 Application.persistentDataPath를 사용하는 것이 일반적

string dataPath = Application.persistentDataPath;

외부 파일(예: 사용자의 문서 폴더에 있는 파일)의 경로를 얻을 때는 System.Environment

string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments); string filePath = Path.Combine(documentsPath, "MyFile.txt");

Unity는 Unity 프로젝트에 StreamingAssets (대소문자 구분)라는 이름의 폴더에 위치한 모든 파일을 타겟 컴퓨터의 특정 폴더에 그대로 복사합니다. 이 폴더를 검색하려면 Application.streamingAssetsPath 프로퍼티를 사용

 

'Unity&C# > Unity' 카테고리의 다른 글

[Unity 2D] Sprite Flip  (0) 2024.10.14
[Unity] Frame  (0) 2024.10.14
[input system] 작성중  (0) 2022.09.20
[Unity] AssetBundle  (0) 2022.09.17
[Unity] Create asset menu  (0) 2022.09.01