I have two buttons. one activates a method that creates a cube, and one create a purple block (see all in video). when I click one button it activates the other button. can anybody help?
Here is some code:
Button 1 activates this method:
public void AddObsticale(int unit)
{
Vector3 unitPos = u.Units[unit].transform.position;
arrow.transform.position =new Vector3(unitPos.x + 4.5f, unitPos.y + 1, unitPos.z - 5f);
arrow.SetActive(true);
StartCoroutine(ArrowChoose());
}
IEnumerator ArrowChoose()
{
yield return new WaitUntil(() => Input.GetKeyDown(KeyCode.Return));
GameObject g = Instantiate(obsticlePrefab, new Vector3(0, 0.5f, arrow.transform.position.z), Quaternion.identity, gameObject.transform);
arrow.SetActive(false);
}
Button 2 (which should not be activated) activates this method:
public void AddUnit()
{
count++;
GameObject g = Instantiate(unitPrefab, new Vector3(0, 0, (count - 1) * unitSize.z), Quaternion.identity, unitsParent.transform);
units.Add(g);
unitText.text = "Units: " + count;
}