Im trying to use Instantiate() to equip an intem in the character model, the object is created in the expected point, but stays there instead of moving with the character mesh. This is my code:
GameObject weapon = Resources.Load("items/ancient-grtsword") as GameObject;
Instantiate(weapon,t.transform.position, Quaternion.identity);
weapon.transform.SetParent(t.transform);
weapon.transform.position = Vector3.zero;
t is a GameObject, assigned from the editor. I have tried both using the bone (the mesh has an specific bone to attach the item), and creating an empty GameObject in the bone and using it. How can I solve this?