Passing an Array between classes

Sorry in advance if this is a dumb question, but there has to be a better way then what I am currently doing.

I have the following,

public class Button : MonoBehaviour {

public int[] Positions = new int[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

public static int[] positionstatic = new int[] {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

void Update ()
{ 
Positions.CopyTo(positionstatic,0);

... code ...}

...other methods...

}

public class Linerender : MonoBehaviour {

doSomething(Button.positionstatic)

}

Thanks in advance!

I’m not sure what exactly you’re trying to do, but I’m assuming you want button’s Positions variable information from the Linerenderer class.

You could expose a button property of the line renderer and hook the Button object to the line renderer in the inspector:

public class Linerender : MonoBehaviour 
{

public Button button;
 

...
doSomething(button.Positions);
...

 
}