Question by
unity_5A1A6EFBB4464B051013 · Jun 24, 2021 at 01:47 PM ·
unity5updateupdate functionupdate problem
Game crashing when im trying to use Inapp update(Unity)
Hello, I published my game to google play. I used scripts from this link: https://developer.android.com/guide/playcore/in-app-updates/unity
Iam pretty sure I have everything set right but every time when I put my script on my empty object. After I published my game to beta version. If I download that game with this update/in app auto update my game crashes and not working. Did u have same problem ? Any solution ?
My code is:
using System.Collections;
using UnityEngine;
using Google.Play.AppUpdate;
using Google.Play.Common;
public class AppUpdate : MonoBehaviour
{
AppUpdateManager appUpdateManager = new AppUpdateManager();
void Start() {
StartCoroutine(CheckForUpdate());
Debug.Log("Update");
}
private IEnumerator CheckForUpdate()
{
PlayAsyncOperation<AppUpdateInfo, AppUpdateErrorCode> appUpdateInfoOperation =
appUpdateManager.GetAppUpdateInfo();
yield return appUpdateInfoOperation;
if (appUpdateInfoOperation.IsSuccessful)
{
Debug.Log("Update Starts");
var appUpdateInfoResult = appUpdateInfoOperation.GetResult();
var appUpdateOptions = AppUpdateOptions.ImmediateAppUpdateOptions();
StartCoroutine(StartImmediateUpdate(appUpdateInfoResult, appUpdateOptions));
}
else{
Debug.Log("ERR. NO NEW UPDATE");
}
}
IEnumerator StartImmediateUpdate(AppUpdateInfo appUpdateInfoOp_i, AppUpdateOptions appUpdateOptions_i)
{
var startUpdateRequest = appUpdateManager.StartUpdate(
appUpdateInfoOp_i,
appUpdateOptions_i);
yield return startUpdateRequest;
}
}
Comment
Your answer
Follow this Question
Related Questions
Loads of errors after upgrading to 2018.3.0f 0 Answers
C# Update Function Question 2 Answers
how's the relationship between updates? 0 Answers
Do Something Once 1 Answer
fixed update is not being called 1 Answer