- Home /
Children of DualTouchControls prefab keep being forced to active
I have a DualTouchControls prefab with some child buttons that I added to it: However, whenever I try to deactivate any of the children (including the touchpads), the box will not uncheck:
Every time I click on that blue check box, it never unchecks. Nothing changes.
I did remove the original jump button that came with the prefab, and it did warn me that removing that button would break the prefab. I'm wondering if this has anything to do with it.
Does anyone have any suggestions on deactivating the children of DualTouchControls?
EDIT: I tested deactivating the children of a new, unbroken instance of the DualTouchControls. I still couldn't deactivate them.
EDIT 2 Solved it! Attached to the DualTouchControls prefab is a script called MobileControlRig. Inside it is a function called EnableControlRig. It has a foreach loop inside of it to activate all children of the prefab:
private void EnableControlRig(bool enabled)
{
foreach (Transform t in transform)
{
//t.gameObject.SetActive(enabled);
}
}
I commented out the foreach loop and deactivating works perfectly now!