In my game, I have a class with a method called by an Equipment.SimpleChanged callback. In this script, I check which items are equipped/unequipped and from which body parts, so that I can apply special rules in some cases. One issue I have is when I want to unequip an equipment from an equipment part (let's say, remove a sword from a scabbard equipment part) and then equip this equipment (e.g. sword) in another equipment part (e.g. right hand). To achieve this, I need to first unequip the sword from the scabbard to the inventory, then wait one frame (Time.deltaTime), then equip the sword from the inventory to the right hand. In a coroutine, I use:
combatant.Equipment.UnequipAccess(scabbardWeapon, combatant);
yield return new WaitForSeconds(Time.deltaTime);
combatant.Equipment.EquipAccess(rightHandEquipmentPartID, scabbardWeapon, combatant, combatant, true);
If I don't use the yield return line, the sword is removed from the scabbard, but it is not put in the right hand.
Is there a way to do that in the same frame?
Also, I'd like to know what is the difference between the EquipAccess and the Equip functions and what does the "bool reset" parameter mean in these functions.
Thanks!