Here's an example:
[SHType]
public class MinMax
{
/// <summary>
/// Minimum value.
/// </summary>
public float Min;
/// <summary>
/// Maximum value.
/// </summary>
public float Max;
}
With the attribute [SHType] and 'class' for this type, it means S3D (and the game) will expect the 'Min' and 'Max' field names preceding the actual value (followed by nullchar).
public struct MinMax
{
/// <summary>
/// Minimum value.
/// </summary>
public float Min;
/// <summary>
/// Maximum value.
/// </summary>
public float Max;
}
Make it a struct, and remove the attribute, then the field names are not 'expected' and the size of the field is explicit by field type (float in this case). This struct is a mere total of 8 bytes, much less then the first 'class' (at 24 bytes).
|