- Home /
Question by
AosmarkYas · Jul 09, 2016 at 02:37 PM ·
uigameobjectbuttonsetactivehide
one button to hide and unihed gameobjects
hello everyone, Im new to unity so....
i have a UI button and I want it to hide and unhide a gameobject
here its what i got: I put this code into a empty gameobject and then the gameobject in the button "onclick" and set to my void... a "if" will do the work? but how i cant figure out. thx
using UnityEngine;
using System.Collections;
public class hide_manager : MonoBehaviour {
public void hideunhide()
{
GameObject.Find("myhorse").SetActive(false);
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612084507im_/https://answers.unity.com/themes/thub/images/avi.jpg)