hello all
First I apologize for my bad English
Secondly I would like to know how I can do that when you collect 100 coins instead of displaying “Coins: 100” … I want to show me something like “beginner”. If I collected 200 coins “advanced” … 300 “experienced”
Here is my script
using UnityEngine;
using System.Collections;
public class CoinsTotalShow : MonoBehaviour {
private int coins = 0;
public Texture2D coinIconTexture;
// Use this for initialization
void Start () {
coins = PlayerPrefs.GetInt("Coins", coins);
}
// Update is called once per frame
void Update () {
}
void FixedUpdate (){
PlayerPrefs.SetInt("Coins",coins);
}
void DisplayCoinsCount()
{
Rect coinIconRect = new Rect(10, 10, 32, 32);
GUI.DrawTexture(coinIconRect, coinIconTexture);
GUIStyle style = new GUIStyle();
style.fontSize = 30;
style.fontStyle = FontStyle.Bold;
style.normal.textColor = Color.yellow;
Rect labelRect = new Rect(coinIconRect.xMax, coinIconRect.y, 60, 32);
GUI.Label(labelRect, coins.ToString(), style);
}
void OnGUI()
{
DisplayCoinsCount();
}
}