Why cant i do this with an array?

Im just starting to learn how to use arrays and classes and im wondering how i can get this to work can someone help me? Thanks!

TestArray

var people = 10;

var personArray : myPerson [];


class myPerson
{
	
}


function Start () 
{
	personArray = new myPerson [people];
}

AddToArray

 var testInventoryObject : Transform;

 class myPerson
    {
    	var myName = "Brandon";
    }
    
    function Update () 
    {
    	if (Input.GetKeyDown("e"))
    	{
    		testInventoryObject.GetComponent(TestArray).personArray[0] = myPerson;
    	}
    }

Can someone tell me how i can make this work?

In Unity, Arrays are very different from built in arrays

A built in array can only contain 1 type of object, but is faster

var lolies:lol[];

You cant change it without creating a new one, it’s non dynamic

A Array is what your used to and is defined like this:

var lolies:Array = [lol]

They are slower, but dynamic

Hope this helps, Benproductions1