Unity는 프로젝트를 빌드할 때 생성된 플레이어 내에서 씬과 에셋을 바이너리 파일로 결합합니다.그러나 파일을 타겟 컴퓨터의 일반 파일 시스템에 저장하여 경로명을 통해 액세스할 수 있습니다.예를 들어 iOS 기기에 동영상 파일을 배포할 경우, PlayMovie
함수를 통해 재생하기 위해서는 원본 동영상 파일이 파일 시스템의 특정 위치에서 사용 가능해야 합니다.이 폴더에는 온디맨드식 다운로드가 아닌 플레이어 설치 시 바로 배포하려는 AssetBundles
를 포함할 수도 있습니다.
Unity는 Unity 프로젝트에 StreamingAssets(대소문자 구분)라는 이름의 폴더에 있는 모든 파일을 타겟 컴퓨터의 특정 폴더에 그대로 복사합니다.이 폴더를 검색하려면 Application.streamingAssetsPath 프로퍼티를 사용하십시오.Application.streamingAssetsPath
를 사용하여 StreamingAssets 폴더의 위치를 얻는 것이 항상 가장 좋습니다. 이렇게 하면 항상 애플리케이션이 실행되고 있는 플랫폼에 있는 위치를 정확하게 가리키기 때문입니다.
Application.streamingAssetsPath
에서 반환하는 위치는 플랫폼마다 다릅니다.
Application.dataPath + "/StreamingAssets"
를 사용합니다.Application.dataPath + "/Resources/Data/StreamingAssets"
를 사용합니다.Application.dataPath + "/Raw"
를 사용합니다."jar:file://" + Application.dataPath + "!/assets"
).Application.streamingAssetsPath
는 웹 서버의 StreamingAssets/
경로를 가리키는 HTTP URL을 반환합니다.예를 들어 애플리케이션이 로컬 개발 서버에서 실행 중인 경우 http://localhost:8000/unity_webgl_build/StreamingAssets/
가 반환됩니다.Android와 WebGL 플랫폼에서는 URL을 반환하기 때문에 파일 시스템 API 및 streamingAssets
path를 통해 스트리밍 에셋 파일에 직접 액세스할 수 없습니다.대신 콘텐츠에 액세스하려면 UnityWebRequest 클래스를 사용하십시오.
참고:
streamingAssets
경로는 읽기 전용입니다.런타임 시 streamingAssets
디렉토리에 새 파일을 수정하거나 작성하지 마십시오.
StreamingAssets 폴더에 있는 .dll 및 스크립트 파일은 스크립트 컴파일 중에 포함되지 않습니다.Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.