I have a public Vector2 that I use for my extended editor as a set of vertices. I change each point through custom handles in the scene view and see the changes to each value in the inspector.
The problem is that when I hit play, the values often revert to an old set. And then when I stop play, the values are set to that old value still, and I lose work.
What do i have to do to ensure changes to my public array commit at run time?
EDIT: Clarity
Here’s an example of what happens. I place the vertices, the array is set, I hit build and the the vertices change (and often delete themselves).
In my code the array is declared
public Vector2[] vertices;
And points are added be re initializing the array
public void AddPoint(Vector2 pos){
Vector2[] newVerts = new Vector2[vertices.Length+1];
for(int i = 0; i < newVerts.Length; i++)
{
if(i < vertices.Length)
newVerts _= vertices*;*_
* else*
_ newVerts = pos;
* }*_
* vertices = (Vector2[])newVerts.Clone();*
* }*