How to Set High Score On Unity + C# Script
So, In this short article we gonna to see how to established higher rating on game deveoping motor unity with C# script.Unity is an all reason game motor that supports 2d and 3D graphics, drag and drop performance and scripting via C#. Two other programming languages were supported: Boo, which was deprecated with the release of Unity 5 and UnityScript.
Highscore is the principal component of the game, so in this tutorial we gonna to see how to established and reterive highscore with diffent scenes and differne scripts with very least difficult method.
by making use of this methos you can retail outlet not only highscore also we can retail outlet string,float,int variable values permanently
there is no variable decalration or values assignment required,
so allows will get started off. initially we need a game scene to established higher rating.
In this article, the higher rating is now , to established a highscore just follow given line,
highscore is an community variable so we really don’t need to decalare any variable.. you can create anything at all you want.
exmable to established highscore
In UPDATE Operate
if(currentscore > PlayerPrefs.GetInt(“highscore”)
From this code, i am examining latest rating by highscore, if latest rating is better than higher rating then established new rating as a higher rating..
To Assing Large Score
highscore is an string like a varibale to retail outlet higher rating.
latest rating is an int variable
To Get Large Score
int a = PlayerPrefs.GetInt(“highscore”)
in this article A suppliers higher scores from variable highscore.
we can use this approaches for retail outlet string,int,float datatype values, also we can use/get values from any script we want..
To Download this venture Simply click download underneath.