Hi
My game has one player and I want to have a simple score board to show at least 5 recent scores.
Any help is highly appreciated.
Hi
My game has one player and I want to have a simple score board to show at least 5 recent scores.
Any help is highly appreciated.
PlayerPrefs.SetFloat();
Could you explain more please ?!
PlayerPrefs is used to set and get information that is saved or to be saved. Look it up.
You can then apply that info to your top scores (or most recent).
So, score game1.
PlayerPrefs.SetFloat(“game1Score”, score);
And so on for each. Then, apply that data to a text objects, text mesh component, like this…
game1Score = PlayerPrefs.GetFloat(“game1Score”);
TextData = TextObject.GetComponent(TextMesh);
TextData.text = game1Score .ToString();
There is a good asset on the asset store called easy high scores. Does exactly what you want.
Thanks, renman3000.
Unfortunately, I can’t buy it !
You’d pretty much never use floats for saving a score, only ints. Anyway, have a look at ArrayPrefs2.
–Eric
Thanks, Eric.
This is in JavaScript, does anyone have the C# version ?!
Please, does anyone have the C# version ?!
I really need this
I found ArrayPrefs, it has a c# version.
What is the difference between ArrayPrefs and ArrayPrefs2 ?!
Sorry I’m not a programmer, how can I use ArrayPrefs in my game ?!
You can use App42 Unity assets for your leader board which is in C# version.you can easily save your score and also maintain the leader board with score management as well as reward management for your leader board
Do this
var Array1:String[ ];
var Array2:int[ ];
var Array3:Array;
var Array4:Array;
var check : boolean;
var tempobj:String;
var tempfloat : float;
var Enemy1:String;
var Enemy2:String;
var Enemy3:String;
var i:int;
function Update()
{
Array1 = [“a”,“b”,“c”];
Array2 = [20, 10, 30];
check = true;
while(check)
{
check = false;
for( i = 0; i < Array2.length - 1; i++)
{
if(Array1*.IndexOf(Array1[i+1])==-1)*
{
if(Array2 > Array2[i + 1])
{
tempobj = Array1[i + 1];
tempfloat = Array2[i + 1];
Array1[i + 1] = Array1*;*
Array2[i + 1] = Array2*;*
Array1 = tempobj;
Array2 = tempfloat;
check = true;
}
}
}
}
}