Is it better to use structs over classes for serializing class settings?
Class settings can have initial default values.
[Serializable]
public class LevelSettings
{
// Default level values
public int Depth = 3;
public int Height = 3;
public TileSettings[] TileSettings = new TileSettings[27];
public int[] TriangleIndices = new int[0];
public Vector3[] TriangleVertices = new Vector3[0];
public float TileSize = 1;
public int Width = 3;
}
Structs will take up less memory (and load faster?) but I can't have default settings already set:
[Serializable]
public struct LevelSettings
{
// Default level values
public int Depth;
public int Height;
public TileSettings[] TileSettings;
public int[] TriangleIndices;
public Vector3[] TriangleVertices;
public float TileSize;
public int Width;
public LevelSettings(int depth, int height, TileSettings[] tileSettings, int[] triangleIndices, Vector3[] triangleVertices, float tileSize, int width)
{
Depth = depth;
Height = height;
TileSettings = tileSettings;
TriangleIndices = triangleIndices;
TriangleVertices = triangleVertices;
TileSize = tileSize;
Width = width;
}
}
So umm, thoughts anyone?