Hello world, I have a problem with the text in Unity, I do not know why the text is not visible when I open the inventory for shopping.
No name appears on the items.
The Scriptures are here
=====GlobalShop Script====
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GlobalShop : MonoBehaviour {
public static string Item01;
public static string Item02;
public static string Item03;
public static string Item04;
public static int ShopNumber;
void Update () {
if (ShopNumber == 1)
{
Item01 = “Lemn”;
Item02 = “Pene”;
Item03 = “Poţiune Roşie”;
Item04 = “Poţiune Albastră”;
}
if (ShopNumber == 2) {
Item01 = “Fier”;
Item02 = “Pene”;
Item03 = “Poţiune Roşie”;
Item04 = “”;
}
}
}
======Shop01Access Script====
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Shop01Access : MonoBehaviour
{
public GameObject ShopInventory;
public GameObject Item01Text;
public GameObject Item02Text;
public GameObject Item03Text;
public GameObject Item04Text;
public GameObject ItemCompletion;
public GameObject CompleteText;
void OnTriggerEnter()
{
ShopInventory.SetActive(true);
Screen.lockCursor = false;
GlobalShop.ShopNumber = 1;
Item01Text.GetComponent().text = “” + GlobalShop.Item01;
Item02Text.GetComponent().text = “” + GlobalShop.Item02;
Item03Text.GetComponent().text = “” + GlobalShop.Item03;
Item04Text.GetComponent().text = “” + GlobalShop.Item04;
}
public void Item01()
{
ItemCompletion.SetActive(true);
CompleteText.GetComponent().text = "Sunteți sigur că doriți să cumpărați " + GlobalShop.Item01 + “?”;
}
public void Item02()
{
ItemCompletion.SetActive(true);
CompleteText.GetComponent().text = "Sunteți sigur că doriți să cumpărați " + GlobalShop.Item02 + “?”;
}
public void Item03()
{
ItemCompletion.SetActive(true);
CompleteText.GetComponent().text = "Sunteți sigur că doriți să cumpărați " + GlobalShop.Item03 + “?”;
}
public void Item04()
{
ItemCompletion.SetActive(true);
CompleteText.GetComponent().text = "Sunteți sigur că doriți să cumpărați " + GlobalShop.Item04 + “?”;
}
public void CancelTransaction()
{
ItemCompletion.SetActive(false);
}
}