Why does my instatiate crashes editor?

After enetering the any weapon trigger editor crashes(it’s becasue weapon kind which we have triggered is spawning all time, but i don’t know why, because insattiate isn’t inside Update method) What’s wrong with my code? WeaponsHabit.cs · GitHub

You pass it the reference to the object you just destroyed. Try this :

    private void OnTriggerEnter(Collider other)
    {
        SetWeapon(other.gameObject);
        GameObject.Destroy(other.gameObject); // delete other game object after instantiating
        hasWeapon = true;
    }