Cannot resize UI Panel

That’s the code (it’s pretty self-explanatory):

	bool showMenu;
	GameObject overLay; //this is the GameObject (the panel) with the RectTransform attached to it

	void Start()
	{
		showMenu = false;
		overLay = GameObject.Find ("Overlay");//That's the name of the panel
		overLay.SetActive (false); // I want to activate only when I click the button (this works)
	}
		
	void Update () {
		var getLeft = overLay.GetComponent<RectTransform> (); //getting the recttransform from the Panel
		if (showMenu == true) {
			
			overLay.SetActive (true); //activating the panel
			var transP = getLeft.sizeDelta; 
			transP = new Vector2 (0,0); //this part of the code is supposed to resize the Panel but it does absolutely nothing , no matter what value I put in
		} 
		else if (showMenu == false) {
			Debug.Log ("do stuff here");
		}
	}

	public void activateMenu(){ //Function that sets the showMenu to true once I click a button
		showMenu = true;
	}

What I’m trying to do here is get the panel gameobject and then get the panel recttransform. I use the recttransform to resize the panel but anything I try does nothing.

Setting transP to the new Vector2 won’t affect the actual sizeDelta. transP isn’t referencing the sizeDelta of the RectTransform, it’s just storing the same value as it. Perhaps changing the if statement to this:

if (showMenu == true)
{
    overLay.SetActive(true); //activating the panel
    getLeft.sizeDelta = new Vector2(0, 0);
}