Is it possible to change the element name in an Array List?


I am creating an array List of Vector3 values like this:

var attackerWayPointArray = new List.<Vector3>();

Rather than having each value named as ‘Element 0’, ‘Element 1’ etc, I would like to be able to change the element name to something more like ‘Start’ so that I can search for the Vector3 value by name.

This is so that I can refer to the way-points as they will be constantly changing.

Is this possible?

What you describe is a dictionary:

var myDic = new Dictionary.<String, Vetcor3>();
myDic["Start"] = Vector3(10,10,10);

transform.position = myDic["Start"];

You could also use Hashtable Class (System.Collections) | Microsoft Learn