대부분의 Unity 에셋은 빌드될 때 프로젝트에 합쳐집니다. 그러나 때로는 파일을 타겟 컴퓨터의 일반 파일시스템에 저장하여 경로명을 통해 액세스할 수 있도록 하는 편이 유용합니다. iOS 디바이스에 동영상 파일을 배포할 때가 바로 그러한 예입니다. PlayMovie
함수를 통해 재생하기 위해서는 오리지널 동영상 파일이 반드시 파일시스템의 어떤 위치에서 사용 가능해야 합니다.
Unity 프로젝트에 StreamingAssets(대소문자 구분)이라는 이름의 폴더에 위치한 모든 파일은 타겟 컴퓨터의 특정 폴더에 그대로 복사됩니다. Application.streamingAssetsPath 프로퍼티를 사용하여 이 폴더를 검색할 수 있습니다. StreamingAssets 폴더의 위치를 얻으려면 항상 Application.streamingAssetsPath
를 사용하는 것이 좋습니다. 이것은 항상 애플리케이션이 실행되고 있는 플랫폼에 있는 해당 위치를 정확하게 가리킵니다.
이 폴더의 위치는 플랫폼마다 다릅니다. 대소문자를 구분한다는 것을 참조하십시오.
데스크톱 컴퓨터(Mac OS 또는 Windows)에서는 다음 코드를 사용하여 파일의 위치를 얻을 수 있습니다.
path = Application.dataPath + "/StreamingAssets";
iOS에서는 다음을 사용해야 합니다.
path = Application.dataPath + "/Raw";
Android에서는 다음을 사용해야 합니다.
path = "jar:file://" + Application.dataPath + "!/assets/";
Android에서 파일은 .jar 압축 파일(보통 .zip 압축 파일과 거의 같은 포맷)에 들어 있습니다. Unity의 WWW 클래스로 파일을 가져오지 않으면 추가 소프트웨어를 사용해야만 .jar 아카이브 내부를 보고 파일을 가져올 수 있습니다.
참고: 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.