Hi I have the follow code.
[StructLayout(LayoutKind.Explicit)]
public struct BlockInt
{
[FieldOffset(0)]
public uint Block; //Contains the Entire Block Data
[FieldOffset(0)]
public byte Type; //the Block type. Ie Resource, Building Matrerial, Plant, Gas, Fluid
[FieldOffset(1)]
public byte SubType; //The sub type. Ie if the type is Resource the sub type could be Iron, Coal, etc
[FieldOffset(0)]
public ushort BlockId; //The block Id. A combanation of both the Type, and Subtype
[FieldOffset(2)]
public byte Orientation; //the orientation of the block
[FieldOffset(3)]
public byte Data; //the data that the block can contain
}
I have 2 questions.
First can I use [StructLayout(LayoutKind.Explicit)] on all platforms or do some platforms not have access to the InteropServices namespace?
And seconds whats the overhead in memory of having this vers just a single uint?
Thx