Hi guys,
as I didn’t find a solution for this problem, I’m gonna ask here.
I placed a toggle button from an asset prefab in my scene which contains a “Toggle (Script)” with the property/variable “Is On” giving the button’s state.
In a function I need to check this button’s state. Normaly I use the GetComponent method as shwon in the code snippet but here that did not work, “Toggle” doesn’t seem to be a valid Component
public GameObject myPrefab
void Start (){
Debug.Log(myPrefab.GetComponent<Toggle>().IsOn);
}
Any idea what I’m doing wrong?
Thanks in advance,
Tobi