Weapons aren't added to inventory/shown on character properly when added in certain orders.

Ascendance Games

New member
I have two guns on my character to choose from. When I add gunA first, then gunB, they both work and I can switch between them. But when I add gunB first neither work, models for guns aren't shown, and I cannot switch. What may cause this?

Here's how they are being added.

Code:
        for (int i = 0; i < datas.Count; i++)
        {
            WeaponData data = datas[i];
            if (data == null)
                continue;

            bool firstEntry = (i == 0);
            //Pickup weapon.
            _inventory.PickupItemType(data.WeaponItem, 1, -1, firstEntry, firstEntry);
           
            //Add ammo if required.
            if (data.AmmoItem != null)
            {
                float ammoQuantity;
                //Add capacity.
                if (data.StartingAmmo == -1)
                    ammoQuantity = data.AmmoItem.Capacity;
                else
                    ammoQuantity = data.StartingAmmo;

                _inventory.PickupItemType(data.AmmoItem, ammoQuantity, -1, firstEntry, firstEntry);
            }
        }

Edit: there seems to be an issue with force equipping the ammo, as it's overriding the gun (perhaps). When I turn off forceEquip on the ammo the gun works, but I'm unable to switch to another weapon; this results in nothing being equip, and I'm unable to switch back to the original weapon.
 
Last edited:
If the weapons aren't shown then it is generally an equip problem:


If it works one way but not another my guess is that it is related to an animation event that isn't being fired.
 
Top