I want to create object "A" which will have x, y parameters. and A must be an array. What's best practice of declaring and constructing such object ? for example something like this:
A[0].x=5
A[0].y=3
A[1].x=6
A[1].y=4
Update I've done this way:
public class PersonalWaypoints
{
public float x { get; set; }
public float y { get; set; }
}
public class MainClass:MonoBehaviour
{
then in void Start() {
PersonalWaypoints[] pw = new PersonalWaypoints[waypoints.Length];
pw[0].x = waypoints[0].transform.position.x ;
pw[0].y = waypoints[0].transform.position.y ;
but then I cannot use pw in Update() { because it doesn't exist in current context.
And to have it in context I cannot move PersonalWaypoints[] pw = new PersonalWaypoints[waypoints.Length]; to class definition because waypoints.Length is unknown while defining class.