using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Money : MonoBehaviour
{
public int money;
public int Up;
public Text moneytext;
public GameObject paceje;
public GameObject player;
void Start()
{
money = PlayerPrefs.GetInt("money", 0);
moneytext = Text.FindWithTag("moneyText");
player = GameObject.FindWithTag("Player");
}
void Update()
{
PlayerPrefs.SetInt("money", money);
moneytext.text = "$" + money;
}
private void OnTriggerEnter(Collider player)
{
money = money + Up;
Debug.Log("money+ " + Up);
}
}
надо чтобы moneytext назначался объект с тэгом moneytext