728x90
728x170
private void ShowToastMessage(string message)
{
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity.3d.player.UnityPlayer");
AndroidJavaObject unityActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
if (unityActivity != null)
{
AndroidJavaClass toastClass = new AndroidJavaClass("android.widget.Toast");
unityActivity.Call("runOnUiThread", new AndroidJavaRunnable(() =>
{
AndroidJavaObject toastObject = toastClass.CallStatic<AndroidJavaObject>("makeText", unityActivity, message, 0);
toastObject.Call("show");
}));
}
}
728x90
그리드형
'Unity' 카테고리의 다른 글
[Unity] Multiple precompiled assemblies with the same name Newtonsoft.Json.dll (0) | 2022.01.18 |
---|---|
언리얼 학습 (0) | 2021.12.30 |
[Unity] 배포파일 만들기 (aab / apk) (0) | 2021.12.04 |
[Unity] Json 사용하기 - JSON .NET For Unity (0) | 2021.12.03 |
[Unity] Tilia 패키지 (0) | 2021.11.15 |