using Unity.Collections.LowLevel.Unsafe; namespace GameCore.LowLevel { public static class StructUtility { public static int OffsetOf() where T : struct where F : struct { var fields = typeof(T).GetFields(); foreach (var f in fields) { if (f.DeclaringType == typeof(F)) return UnsafeUtility.GetFieldOffset(f); } return -1; } } }