Hi, basically I wrote a code that use a dictionary to create child gameobject to the character and then added specific weapon's slot and bones during the runtime. However the colliders are not working. Strangely it only works during the Play when I clicked the hitbox child gameobject and view it in the Inspector, once the inspector shows, the collider immediately works.
void CreateWeaponHitbox(string weaponDef)
{
GameObject weaponHitBox = new GameObject(weaponDef);
weaponHitBox.transform.parent = this.transform;
BoundingBoxFollower boundingBoxFollower = weaponHitBox.AddComponent<BoundingBoxFollower>();
boundingBoxFollower.isTrigger = true;
boundingBoxFollower.slotName = _WeaponDefs[weaponDef].HitBoxSlot;
BoneFollower boneFollower = weaponHitBox.AddComponent<BoneFollower>();
boneFollower.boneName = _WeaponDefs[weaponDef].HitBoxBone;
Rigidbody2D rb = weaponHitBox.AddComponent<Rigidbody2D>();
SpawnedChildFollower spawnedChildFollower = weaponHitBox.AddComponent<SpawnedChildFollower>();
SlashDamage slashDamage = weaponHitBox.AddComponent<SlashDamage>();
slashDamage.power = _WeaponDefs[weaponDef].Power;
boundingBoxFollower.Initialize(true);
boneFollower.Initialize();
} The initialization won't help either