Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug ContentStatistics are null when receiving content by ContentTrendType.Newest

Discussion in 'Unity User-Generated Content' started by Tirt, Jul 18, 2023.

  1. Tirt

    Tirt

    Joined:
    Jul 11, 2022
    Posts:
    9
    Example:

    Code (CSharp):
    1.  #region Issue for Forums
    2. private async void Test()
    3. {
    4.         var contentsNewest = await GetContentByNewest();
    5.         Debug.Log(contentsNewest[0].Statistics == null); // will return true
    6.  
    7.         var contentsOtherTrend = await GetContentByAnyOtherTrend(ContentTrendType.Popular);
    8.         Debug.Log(contentsOtherTrend[0].Statistics == null); // will return false
    9.     }
    10.  
    11.     private async Task<List<Content>> GetContentByNewest()
    12.     {
    13.         var trendArgs = new GetContentTrendsArgs(ContentTrendType.Newest);
    14.         var contents = await UgcService.Instance.GetContentTrendsAsync(trendArgs);
    15.  
    16.         return contents.Results;
    17.     }
    18.  
    19.     private async Task<List<Content>> GetContentByAnyOtherTrend(ContentTrendType trendType)
    20.     {
    21.         var trendArgs = new GetContentTrendsArgs(trendType);
    22.         var contents = await UgcService.Instance.GetContentTrendsAsync(trendArgs);
    23.  
    24.         return contents.Results;
    25. }
    26. #endregion
    This is a better version of the original post as that post is all over the place due to not fully understanding and explaining the issue.