Answer the question
In order to leave comments, you need to log in
How to disable/enable child element?
The Cell object has a SelectCell child element (selection frame), initially it should be turned off, the question is how to determine and turn it off immediately in the prefab and then turn it off / on from another script?
In the prefab creation script, they are created like this
Cells[Num] = Instantiate(Prefab new Vector3(x, y, 0), Quaternion.identity) as Cell;
.........
public Transform SelectCell;
private void Start(){
SelectCell = transform.Find("SelectCell");
SelectCell.active = false;
}
.........
'Transform' does not contain a definition for 'active' and no accessible extension method 'active'
Member 'GameObject.Find(string)' cannot be accessed with an instance reference; qualify it with a type name instead
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question