internal static void VerifyGlobalNPC(GlobalNPC npc) { var type = npc.GetType(); bool hasInstanceFields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) .Any(f => f.DeclaringType != typeof(GlobalNPC)); if (hasInstanceFields) { if (!npc.InstancePerEntity) { throw new Exception(type + " has instance fields but does not set InstancePerEntity to true. Either use static fields, or per instance globals"); } } }