This is the script I am using and I can’t drag the text object from the hierarchy to Wood Text in the inspector. There is no error and no mistakes in the other scripts.
What should I do?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ResourceManager : MonoBehaviour
{
public int wood = 0;
public int stone = 0;
public int add = 1;
public Text woodText;
public Text stoneText;
public BuildingPlacementSystem bSbuildingPlacementSystem;
void Start()
{
UpdateWoodCount(wood);
UpdateStoneCount(stone);
}
public void AddWood()
{
wood += add;
UpdateWoodCount(wood);
}
public void ReduceWood()
{
wood -= bSbuildingPlacementSystem.buildingWoodCost;
UpdateWoodCount(wood);
}
public void AddStone()
{
stone += add;
UpdateStoneCount(stone);
}
public void ReduceStone()
{
stone -= bSbuildingPlacementSystem.buildingstoneCost;
UpdateStoneCount(stone);
}
public void UpdateWoodCount(int wood)
{
woodText.text = "Wood: " + wood;
}
public void UpdateStoneCount(int stone)
{
stoneText.text = "Stone: " + stone;
}
}