I am trying to find the parent of a prefab object (a custom class that inherits from Toggle) dynamically doing this :
var parentObject = this.transform.parent;
However, parentObject is returned null, despite the parent object existing and being interactable in the UI. Anyone knows what the reason could be? Am I doing it wrong?
I also tried running the following code :
if (this.transform.IsChildOf(transform))
{
Debug.Log("Object" + this.ToString() + " has parents");
}
Which returns "Object myPrefab (CustomToggle) has parents"