Unity
[Unity] Toast Message 처리하기
kjun.kr
2021. 12. 30. 23:33
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
그리드형