Hello everyone,
I'm new on the forum and recently started learning C#, I'm still a beginner when it comes to programming.
I'm trying to make multiple instances of a class in the same way i would make an array but i get the following error:
System.NullReferenceException: 'Object reference not set to an instance of an object.'
Pawn[] was null.
Can anyone tell me how to do this properly?
I'm new on the forum and recently started learning C#, I'm still a beginner when it comes to programming.
I'm trying to make multiple instances of a class in the same way i would make an array but i get the following error:
System.NullReferenceException: 'Object reference not set to an instance of an object.'
Pawn[] was null.
Example:
Pawn[] Pawn = new Pawn[5];
public void ReachPawn()
{
Pawn[1].x = 5;
}
Can anyone tell me how to do this properly?