New to C#, and I am sure this is simple but i have been beating my head against it for a couple days.
I need to change the text field on the “Number” child of “ButtonWater” via the script below. I am using Unity 4.6 Thanks in advance for any help.
using UnityEngine;
using System.Collections;
public class Script_CraftButMan : MonoBehaviour
{
// public string ThisButton : UnityEngine.UI.Button;
public Transform craftingTable;
public string name;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
}
public void AddToTable()
{
//Instantiates material into crafting table
GameObject test = Instantiate(Resources.Load("Prefabs/Prefab_" + name)) as GameObject;
test.transform.SetParent(craftingTable);
//Here is where i am trying to access the text of the "Number" child.
this.GetComponentInChildren<GUIText>().text = "testing";
}
}