static ComponentBuilder() { ENTITY_COMPONENT_TYPE = typeof(T); DEFAULT_IT = default; IS_ENTITY_VIEW_COMPONENT = typeof(IEntityViewComponent).IsAssignableFrom(ENTITY_COMPONENT_TYPE); HAS_EGID = typeof(INeedEGID).IsAssignableFrom(ENTITY_COMPONENT_TYPE); HAS_REFERENCE = typeof(INeedEntityReference).IsAssignableFrom(ENTITY_COMPONENT_TYPE); ENTITY_COMPONENT_NAME = ENTITY_COMPONENT_TYPE.ToString(); IS_UNMANAGED = ENTITY_COMPONENT_TYPE.IsUnmanagedEx(); if (IS_UNMANAGED) { EntityComponentIDMap.Register <T>(new Filler <T>()); } SetEGIDWithoutBoxing <T> .Warmup(); ComponentBuilderUtilities.CheckFields(ENTITY_COMPONENT_TYPE, IS_ENTITY_VIEW_COMPONENT); if (IS_ENTITY_VIEW_COMPONENT) { EntityViewComponentCache.InitCache(); } else { if (ENTITY_COMPONENT_TYPE != ComponentBuilderUtilities.ENTITY_INFO_COMPONENT && ENTITY_COMPONENT_TYPE.IsUnmanagedEx() == false) { throw new Exception( $"Entity Component check failed, unexpected struct type (must be unmanaged) {ENTITY_COMPONENT_TYPE}"); } } }
static ComponentBuilder() { ENTITY_COMPONENT_TYPE = typeof(T); DEFAULT_IT = default; IS_ENTITY_VIEW_COMPONENT = typeof(IEntityViewComponent).IsAssignableFrom(ENTITY_COMPONENT_TYPE); #if SLOW_SVELTO_SUBMISSION HAS_EGID = typeof(INeedEGID).IsAssignableFrom(ENTITY_COMPONENT_TYPE); HAS_REFERENCE = typeof(INeedEntityReference).IsAssignableFrom(ENTITY_COMPONENT_TYPE); SetEGIDWithoutBoxing <T> .Warmup(); #endif ComponentID <T> .Init(); ENTITY_COMPONENT_NAME = ENTITY_COMPONENT_TYPE.ToString(); IS_UNMANAGED = TypeType.isUnmanaged <T>(); //attention this is important as it serves as warm up for Type<T> #if UNITY_NATIVE if (IS_UNMANAGED) { EntityComponentIDMap.Register <T>(new Filler <T>()); } #endif ComponentBuilderUtilities.CheckFields(ENTITY_COMPONENT_TYPE, IS_ENTITY_VIEW_COMPONENT); if (IS_ENTITY_VIEW_COMPONENT) { EntityViewComponentCache.InitCache(); } else { if (ENTITY_COMPONENT_TYPE != ComponentBuilderUtilities.ENTITY_INFO_COMPONENT && ENTITY_COMPONENT_TYPE.IsUnmanagedEx() == false) { throw new Exception( $"Entity Component check failed, unexpected struct type (must be unmanaged) {ENTITY_COMPONENT_TYPE}"); } } }