I currently have a Match struct which contains a list of Blocks.
public struct Match{
public List<Block> blocks;
}
When I try to create a new Match (in this case, called matchData) and add Blocks to its Block list, my compiler outputs:
Use of unassigned local variable 'matchData'
I tried initializing the list by doing this:
public struct Match{
public List<Block> blocks = new List<Block>();
}
which results in the following error:
Structs cannot have instance field initializers
So how should I initialize my Match struct? Do I have to make a constructor?