How to make new rect stop updating itself.

I know that what I have done can be achieved with a loop.

My question is, how can I generate a new textfield every single time I hit the “+” button?
And why does all the textfields update their current position to the variable top? An example is this one (it’s just for a test not the final code):

using UnityEngine;
using System.Collections;

public class Afisare : MonoBehaviour {
	
	string[] maher;
	int top = 10, i = 0;
	bool ad = false;
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	void OnGUI(){
		maher = new string[5];
		if(GUI.Button(new Rect(10, 10, 20, 20), "+")){
			ad = true;
		}
		
		if(ad){
			maher *=  GUI.TextField(new Rect(10, top, 200, 20), 2 + "", 25);*
  •  	top += 40;*
    
  •  	i++;	*
    
  •  }*
    
  • }*
    }

You want to use an array and add each new rect to the array. Then in OnGUI you will do a simple for loop over rects array to create the fields. In the below example you will need to add using System.Collection.Generic; in order to use List

 List<Rect> rects = new List<Rect>();

 void OnGUI()
 {
     if(GUI.Button(...))
     {
         rects.Add(new Rect(10, top, 200, 20));
         top += 40;
     }
     if(rects.Count > 0)
     {
         for(int i =0;i<rects.Count;i++)
         {
              GUI.TextField(rects*, 2 + "", 25);*

}
}
}