반응형
- 코드 작성
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Example : MonoBehaviour
{
void Start()
{
#if UNITY_EDITOR
Debug.Log("유니티 에디터에서 실행");
#elif UNITY_ANDROID
Debug.Log("안드로이드에서 실행");
#elif UNITY_IOS
Debug.Log("아이폰에서 실행");
#elif UNITY_WEBGL
Debug.Log("웹에서 실행");
#endif
}
}
- 다른 방법
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Example : MonoBehaviour
{
void Start()
{
if(Application.platform == RuntimePlatform.Android)
{
Debug.Log("안드로이드에서 실행");
}
else if(Application.platform == RuntimePlatform.IPhonePlayer)
{
Debug.Log("아이폰에서 실행");
}
else if (Application.platform == RuntimePlatform.WebGLPlayer)
{
Debug.Log("웹에서 실행");
}
else
{
Debug.Log("유니티 에디터에서 실행");
}
}
}
반응형
'개발 > C#' 카테고리의 다른 글
유니티 C# 일시정지 Pause 구현하기 간단 사용법 (0) | 2022.07.06 |
---|---|
유니티 C# 화면 터치 드래그 Touch Drag 간단 사용법 (0) | 2022.07.06 |
유니티 C# 해상도 설정 SetResolution 간단 사용법 (0) | 2022.07.06 |
유니티 C# 시스템 언어 가져오기 System Language 간단 사용법 (0) | 2022.07.06 |
유니티 C# 공전, 자전 간단 구현 Revolution (0) | 2022.07.05 |
유니티 C# 스킨드 메쉬 랜더러 Blend Shape 설정 간단 사용법 (0) | 2022.07.05 |
유니티 C# 메테리얼 알파값 간단 변경법 Unity Material Alpha (0) | 2022.07.05 |
유니티 C# 비동기 프로그래밍 Task 간단 사용법 (0) | 2022.06.30 |
댓글