UI представлен в виде спрайтов?
Если расположен на Canvas
параметр order in layer какое значение имеет?
Canvas "привязан" к камере или к World Space?
public int Money;
public int Rand;
public enum ShopCheck { Shop , OpenBrawl };
public ShopCheck shopCheck;
public Text text;
public Chance[] Brawls;
private void Awake()
{
Money = PlayerPrefs.GetInt("Cash" , 0);
}
void Start()
{
Rand = Random.Range(0, 100);
}
void Update()
{
#region ChanceSystem
for(int i = 0; i < Brawls.Length; i++)
{
if (Rand >= Brawls[i].minSpawn && Rand <= Brawls[i].maxSpawn )
{
this.GetComponent<SpriteRenderer>().sprite = Brawls[i].SpawnObject;
break;
}
}
#endregion
#region PlayerPrefs
PlayerPrefs.SetInt("Cash", Money);
#endregion
if(shopCheck == ShopCheck.Shop)
{
text.text = "$ : " + Money;
}
else
{
}
}
public void OpenBrawl()
{
if(Money >= 100)
{
Money -= 100;
}
}
[System.Serializable]
public class Chance
{
public Sprite SpawnObject;
public int minSpawn = 0;
public int maxSpawn = 0;
}