using System; namespace GameCore.TinyECS { public struct ComponentId { struct Inner where T : unmanaged { public int id; private Inner(int i) => id = i; public static Inner Instance = default; } static int currentId; public static int Get() where T : unmanaged { if (Inner.Instance.id == 0) { Inner.Instance.id = ++currentId; } return Inner.Instance.id; } } }