기기 시뮬레이터는 기기 시뮬레이터의 기기별 동작에 대응하는 코드를 테스트하는 데 사용할 수 있는 시뮬레이션된 클래스를 제공합니다.
다음 시뮬레이션된 클래스는 UnityEngine.Device 네임스페이스에 있습니다.
이러한 시뮬레이션된 클래스에는 일반 UnityEngine 네임스페이스와 동일한 멤버가 있습니다. 일반적으로 일반 클래스를 사용하는 코드베이스의 어느 곳에서나 사용할 수 있습니다. 성능에 미치는 영향은 없으며 릴리스 빌드에서 사용할 수 있습니다.
에디터에서 기기 시뮬레이터가 액티브일 때, 시뮬레이션된 클래스는 시뮬레이션된 기기의 플랫폼별 동작을 모방합니다. 예를 들어 Device.SystemInfo.operatingSystem은 시뮬레이션된 기기의 Android 또는 iOS 버전을 반환합니다.
빌드된 애플리케이션이나 기기 시뮬레이터가 액티스 상태가 아닌 경우 시뮬레이션된 클래스는 UnityEngine 네임스페이스의 해당 클래스와 동일한 동작을 합니다.
시뮬레이션된 클래스는 일반 클래스와 동일한 멤버를 갖지만 기기 시뮬레이터가 모든 동작을 시뮬레이션하지는 않습니다. Unity 에디터에서 기기 시뮬레이터가 시뮬레이션하지 않는 멤버는 플랫폼에 의존하지 않는 UnityEngine과 동일한 동작을 합니다. 예를 들어, 기기 시뮬레이터는 Device.Screen.brightness를 시뮬레이션하지 않습니다. 즉 이 멤버가 항상 1
을 반환하는 UnityEngine.Screen.brightness와 에디터 내에서 동일하게 동작함을 의미합니다. 기기 시뮬레이터가 시뮬레이션하는 멤버에 대한 자세한 내용은 다음 API 문서를 참조하십시오.
UnityEngine.Device 네임스페이스의 클래스를 사용하도록 기존 코드를 전환하려면 별칭 지시문을 사용하는 것이 가장 좋습니다. 예를 들면 다음과 같습니다.
using Screen = UnityEngine.Device.Screen;
using Application = UnityEngine.Device.Application;
using SystemInfo = UnityEngine.Device.SystemInfo;
이렇게 하면 전체 파일에서 사용하는 클래스를 변경할 수 있고 모든 API 호출을 변경하지 않을 수 있습니다.
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.