728x90
반응형
1. currentActivity Error
1.1 에러 코드
Exception: Field currentActivity or type signature not found
유니티 에디터에서는 currentActivity를 찾을 수 없어 발생하는 문제이다.
using Google.Play.AppUpdate;
using Google.Play.Common;
using System.Collections;
using UnityEngine;
public class MyAppUpdateManager : MonoBehaviour
{
AppUpdateManager appUpdateManager = new AppUpdateManager();
void Awake()
{
appUpdateManager = new AppUpdateManager();
}
// Start is called before the first frame update
void Start()
{
StartCoroutine(CheckForUpdate());
}
IEnumerator CheckForUpdate()
{
yield return new WaitForSeconds(1.0f);
appUpdateManager = new AppUpdateManager();
}
반응형
1.2 해결방안
아래와 같이 유니티 에디터에서는 동작하지 않도록 구성한다.
아래의 방법은 유니티 에디터에서만 동작하게 하였기 때문에, iOS와 같이 빌드하는 경우 에러가 발생할 수 있다.
using Google.Play.AppUpdate;
using Google.Play.Common;
using System.Collections;
using UnityEngine;
public class MyAppUpdateManager : MonoBehaviour
{
AppUpdateManager appUpdateManager;
// Awake is called
void Awake()
{
#if UNITY_EDITOR
#else
appUpdateManager = new AppUpdateManager();
#endif
}
}
728x90
다음의 코드는 플랫폼이 Android 일 경우에 수행하도록 설정하여 해결하는 코드이다.
RuntimePlatform을 확인하여 안드로이드 일 경우에 수행한다.
using Google.Play.AppUpdate;
using Google.Play.Common;
using System.Collections;
using UnityEngine;
public class MyAppUpdateManager : MonoBehaviour
{
AppUpdateManager appUpdateManager;
// Awake is called
void Awake()
{
if (Application.platform == RuntimePlatform.Android)
{
appUpdateManager = new AppUpdateManager();
}
}
}
728x90
반응형
'Unity > Settings' 카테고리의 다른 글
유니티 IOSResolver.dll Error (0) | 2025.03.26 |
---|---|
유니티 Resolving Android Dependencies (0) | 2025.01.29 |
유니티 Advertisement Legacy (0) | 2025.01.29 |
유니티 Advertisement Legacy - Monetization 연동 (0) | 2025.01.29 |
유니티 안드로이드 API Level Update (API Level 29 ~ 30) (3) | 2021.01.26 |