Collider in ScriptableObject

hi, i am having a problem. i made a scriptable object of a sword so in my attack script i can instantiate it and use its Data, everything is working perfect , except that i need the box collider of this instancieted sword , because in my script i turn on/of the box collider so it only deals damage when i attack, i tried to get the collider of the prefab in the scriptable object , but it isn’t getting the box collider of the instantiated sword

[CreateAssetMenu(fileName = "Weapon", menuName = "Weapons/Make New Weapon", order = 0)]
    public class Weapon : ScriptableObject
{

[SerializeField] Collider weaponCollider;
[SerializeField] GameObject weaponPrefab = null;

public void Spawn(Transform handTransform, Animator anim)
        {
            Instantiate(weaponPrefab, handTransform);
            anim.runtimeAnimatorController = animatorOverrid;
        }

public GameObject Sword()
        {
           return weaponPrefab;
        }

}

and tried to get hold of the collider by using this:

public collider col;

col = weapon.Sword().GetComponent<Collider>();

but it is getting the collider of the prefab , and not from the instancieted sword

On Line 10 you are Instantiating your sword. Instantiate returns a reference to the new in-game instance. You’re not storing that returned value anywhere. Instead, you are leaving the weaponPrefab variable still filled in by the prefab.

You can just recycle that variable, that’s a totally legitimate way to do it:

weaponPrefab = Instantiate<GameObject>(weaponPrefab, handTransform);

From then on during the lifetime of the script instance, weaponPrefab will now point to the actual in-game GameObject.