微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Unity google-play-core 审核问题

如何解决Unity google-play-core 审核问题

我按照repo中的说明添加了google play core包,并根据文档添加代码here

我收到以下错误CS0246: The type or namespace name 'PlayAsyncoperation<,>' Could not be found (are you missing a using directive or an assembly reference?)

错误显示_reviewManager.RequestReviewFlow();_reviewManager.LaunchReviewFlow(_playReviewInfo)

知道可能是什么问题吗?

我的完整代码

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Google.Play.Review;

public class ReviewCodes : MonoBehavIoUr
{
    private ReviewManager _reviewManager;
    private PlayReviewInfo _playReviewInfo;


    // Start is called before the first frame update
    void Start()
    {
        StartCoroutine(RequestReviews());
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    IEnumerator RequestReviews()
    {
        // Create instance of ReviewManager
        _reviewManager = new ReviewManager();

        var requestFlowOperation = _reviewManager.RequestReviewFlow();
        yield return requestFlowOperation;
        if (requestFlowOperation.Error != ReviewErrorCode.NoError)
        {
            // Log error. For example,using requestFlowOperation.Error.ToString().
            yield break;
        }
        _playReviewInfo = requestFlowOperation.GetResult();

        var launchFlowOperation = _reviewManager.LaunchReviewFlow(_playReviewInfo);
        yield return launchFlowOperation;
        _playReviewInfo = null; // Reset the object
        if (launchFlowOperation.Error != ReviewErrorCode.NoError)
        {
            // Log error. For example,using requestFlowOperation.Error.ToString().
            yield break;
        }
        // The flow has finished. The API does not indicate whether the user
        // reviewed or not,or even whether the review dialog was shown. Thus,no
        // matter the result,we continue our app flow.
    }
}

解决方法

“您是否缺少 using 指令或程序集引用?”

以下情况会导致编译器错误:

  1. 检查类型或命名空间的名称是否正确,因为大多数情况下,当编译器找不到该命名空间时,您会收到此错误。
  2. 检查您是否添加了对包含命名空间的程序集的引用。例如:您的代码可以在“使用 XYZ;” 但如果您的项目没有引用程序集,那么您可能会收到 CS0246 错误。

尝试:使用 Google.Play.Common;

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。