Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

makudi

1
Posts
A member registered Nov 14, 2023

Recent community posts

I'm just wondering why when I enter a new entry it will replace the previous entry . so always there is only one entry even if I submit several values in editor 

my code 


using System.Collections.Generic;

using UnityEngine;

using TMPro;

using Dan.Main;

public class leaderboardd : MonoBehaviour

{

    // Start is called before the first frame update

    [SerializeField]

    private List<TextMeshProUGUI> Names;

    [SerializeField]

    private List<TextMeshProUGUI> Scores;

    private string publicleaderboaedkey = "64284967363c3ef000a80af46de3aba968e5ebfcdcc6406c57cdb0af2b4b5944";

    private void Start()

    {

        GetLeaderboard();

    }

    public void GetLeaderboard()

    {

        LeaderboardCreator.GetLeaderboard(publicleaderboaedkey, ((msg) => {

            int looplength = (msg.Length < Names.Count) ? msg.Length : Names.Count;

        for(int i =0; i< looplength; ++i)

        {

            Names[i].text = msg[i].Username;

            Scores[i].text = msg[i].Score.ToString();

            }

        }));

    }

    public void SetLeaderboard(string username,int score)

    {

        LeaderboardCreator.UploadNewEntry(publicleaderboaedkey, username,score,((msg) => {

            GetLeaderboard();

        }));

    }

}