I have a gameobject (Imported FBX file) with Groups. I want to set visibility off of one of the group. I tried following code but not working.
private GameObject headBoard;
void Start()
{
headBoard=GameObject.Find("Group1");
}
void Update()
{
headBoard.renderer.enabled=false;
}
I am not able to Hide that specific group. Can anyone please help me…???
If what you want is activate and deactivate object and its children, you can use
gameObject.SetActiveRecursively(true or false);
Set false for having it all off.
If you’re trying to disable the group you could just make it inactive using headBoard.SetActiveRecursively(false); unless of course you have a specific reason for just disabling the renderer.
using UnityEngine;
using System.Collections;
public class disableGroup : MonoBehaviour {
private GameObject headBoard;
void Start () {
headBoard = GameObject.Find("Group1");
}
void Update () {
if (headBoard.active) {
headBoard.SetActiveRecursively(false);
}
}
}
`
`