so i made a few sword models and i want that when i change the sword mesh filter the mesh collider also updates altough i didnt understand how to refrence it. here is my cuurent code for making it. also if possible i would much prefer to use a box collider but i have zero idea how t oupdate a box collider when a mesh changes
;
[SerializeField] MeshFilter sword;
[SerializeField] MeshCollider swordcollider;
[SerializeField] Mesh[] mesh1;
private int currentmesh = 0;
public void changesword()
{
sword.mesh = mesh1[currentmesh];
swordcollider.mesh = mesh1[currentmesh];
currentmesh++;
if (currentmesh > mesh1.Length) { currentmesh = 0; }
}
also i do want to state that i have no idea what i am doing when it comes to meshes and mesh colliders which is why i didnt understand what to write. also the current mesh is a list of the sword meshes that way its way easier for me to switch. any help is apreciatted!