tips/유니티 & 개발
유니티에서 플랫폼 구분하여 스크립트
디지털 수공업자
2022. 6. 30. 15:17
반응형
#if문으로 실행된 기기의 플랫폼에 따라 구분되어 실행합니다. 유니티 에디터에서 프리뷰할 때에도 빌드셋팅에서 설정된 플랫폼에 따라 구분되어 실행됩니다.
#if UNITY_ANDROID
// Android
#elif UNITY_IOS
// iOS
#elif UNITY_EDITOR
// other
#endif
유니티 에디터에서 설정된 플랫폼에는 반응하지 않고 앱이 실행되는 기기에 따라 구분되어 동작하려면 if문을 사용합니다.
if(Application.platform == RuntimePlatform.Android) {
// Android
}
else if(Application.platform == RuntimePlatform.IPhonePlayer) {
// iOS
}
else {
// other
}
유니티 플랫폼 의존 컴파일 : https://docs.unity3d.com/kr/530/Manual/PlatformDependentCompilation.html
Xcode 설치 공간 부족으로 앱스토어 다운로드 안될 때 : https://boxwitch.tistory.com/393
유니티 노치 대응 : https://boxwitch.tistory.com/390
반응형