How do I calculate how big my struct is?

I’ve read it’s a good idea to keep one’s structs within 16 bytes. I have this struct:

public struct Astarnode {
	
	public byte x, y;
	public short g, h;
	public short f { get { return (short)(g+h); } }
	public bool walkable, open, closed, onPath;
	public byte2D parent;
	
	public Astarnode( byte a, byte b ) {
		x = a; y = b;
		g = 0; h = 0;
		walkable = true;
		open = false;
		closed = false;
		onPath = false;
		parent = new byte2D(a,b);
	}
	
	public void Clear() {
		g = 0;
		h = 0;
		open = false;
		closed = false;
		onPath = false;
		parent = new byte2D(x,y);
	}
	
	public bool HasParent() {
		return parent != new byte2D(x,y);
	}
	
}

Am I right in thinking this struct is 12 bytes large, even if it has methods etc? (2 bytes, 2 shorts, 4 bools, 1 byte2D [which is another struct containing 2 bytes]) (and am I right in thinking Asarnode.f consumes no bytes as it is a property that returns the sum of two other fields?)

You can try using System.GC.GetTotalMemory(), allocate the struct, do System.GC.GetTotalMemory() again, and compare the difference.

I don’t know if you could really argue like this in Unity. People told me that Unity parses this to some native code, like C++ or objective C or whatever language is needed on the platform.

So I don’t think you can calculate your bits and bytes just like that? Or if you can, why not try a simple sizeof?