NO -- SAM is has NOT indeed given the right weapon!

HaHa

Speak for yourself Sam

NO – SAM it has NOT indeed given the right weapon!..

The update method never gets called after dragging it into the weapon slot.

click on pickup… ok
hit i to open inventory

it IS in the slot with the correct icon

Drag it into the Weapon slot… ok

hit i to close inventory

Player is Unarmed no weapon.

        private void UpdateWeapon()
        {
            Debug.Log("Start updateWeapon");
            var weapon = equipment.GetItemInSlot(EquipLocation.Weapon) as WeaponConfig;
            if(weapon == null)
            {
                EquipWeapon(defaultWeapon);
            }
            else
            {
                Debug.Log("Trying to equip the weapon in the else clause updateWeapon");
                EquipWeapon(weapon);
            }
        }

NO debug statements in console…

dang the bad luck

Did you subscribe to the Equipment’s equipmentUpdated event?
In Awake()

            equipment = GetComponent<Equipment>();
            if (equipment)
            {
                equipment.equipmentUpdated += UpdateWeapon;
            }
1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms