So here’s the code
public void selectedOilFarm()
{
if(GUI.Button(new Rect(Screen.width/2, Screen.height/2, 100,30), "Spawn a bot"))
{
Debug.Log ("Spawned");
}
Debug.Log ("This is an oil farm 2");
}
public void BuildingClicked() // Ok a building has been clicked, lets find out what building it is.
{
if(this.gameObject.CompareTag("OilFarm"))
{
if(this.gameObject.transform.FindChild("Selector").gameObject.activeSelf)
{
selectedOilFarm();
Debug.Log("This is a Oilfarm");
}
} else if(this.gameObject.CompareTag("Barracks"))
{
if(this.gameObject.transform.FindChild("Selector").gameObject.activeSelf)
{
Debug.Log("This is a barracks");
}
}
}
if i click the OilFarm i get the Debug.Log(“This is a Oilfarm”); and Debug.Log (“This is an oil farm 2”);
but i dont get the “Spawn a bot” button appearing in my screen
Any idea’s any1?
EditWow a noob, i guess i need to place it in the OnGUI method?Edit