使用 dreamlo 记分牌统一获取 NullReferenceException

Getting NullReferenceException in unity using dreamlo scoreboards

我正在开发我的第一款游戏,在使用 dreamlo 记分板资产时遇到了问题。它基本上是一个简单的排行榜系统,只使用 HTTP GET 请求,没有 PhP/SQL。您可以在这里阅读更多相关信息:Dreamlo

使用资产附带的 class,我在这个函数上得到一个 NullReferenceException:

public string[] ToStringArray()
{
    if (this.highScores == "") return null;


    string[] rows = this.highScores.Split(new char[] { '\n' }, System.StringSplitOptions.RemoveEmptyEntries);
    return rows;
}

请注意,我的程序运行良好,并显示了排行榜,但一旦执行此功能,我就会收到 19 个 NullReferenceExceptions 垃圾邮件。

详细了解 NullReferenceException

然后试试这一行:

 if (string.IsNullOrEmpty(this.highScores)) return null;