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