I wanted to get data available in root canvas from the child/member of the canvas. It's possible to do it using this https://docs.unity3d.com/ScriptReference/Canvas-rootCanvas.html but it is unusable if this.gameobject
does not have canvas component and adding canvas component is out of option , and manually assign the gameobject from unity editor is also out of option because it close the door for automation.
So my question is , how do i get the root canvas gameobject from its child without using this.gameObject.GetComponent<Canvas>().rootcanvas
? I also have tried collider.transform.root
but it fails if the root canvas is not in the top hierarchy.