How to get Rect from scene Button ?


I need to get the Rect of a scene Button, i explain. I’ve a button on my scene, i give it to my script:

public Button myButton;

void Start(){
    Rect myButtonRect = myButton.getRect; ????  

It’s mean that i need the x, y, width and height value of my Button which is already in my scene.

Hope you understand my question :slight_smile:

Thank you for any answer.


Please use myButton.GetComponent().rect