I think it has to do with the fact that you are using a texture when you call EquipedItemSlot and not a string like “Primary”, I dont know why its only not working for primary equiped items. The thing is that this line if (mouseitem.equipmenttype == itemname){
checks if a string type is the same as itemname and when you pass a texture to itemname, I dont think they can check to see if they are the same thing. This is my guess anyway.
There is a work around. I think what you are trying to do is add a texture to the equipment slots button.
So what you need to do is instead of changing itemname to a texture, add another variable to this:
function equipedItemSlot(slot,xpos,ypos,itemname){
for example :
function equipedItemSlot(slot,xpos,ypos,itemname,itemtex){
then when you call EquipedItemSlot do it like this:
equipedItemSlot(16,70,456,“Primary”,Primary);
then in the EquipedItemSlot function you need to change the first button to have the itemtex into it like this:
if (GUI.Button(Rect(xpos,ypos,iconSize,iconSize), itemtex)){
and I think the next button to like this:
if (GUI.Button(Rect(xpos,ypos,iconSize,iconSize),GUIContent (itemname, itemtex, tooltipid))){
anyway that should do the trick. Next time post in the topic RPG INVENTORY SOURCE or I may not see you asking for help. I dont always check the script page but I will always check my post so if you post there you have a better chance of me helping you.
Anyway I hope this works, its hard to tell if it will or not because the code you loaded doesnt show me an inventory to try and equip an item.
Let me know if this did the trick.
EDIT: forgot to mention you will need to call all the EquipedItemSlot like this format equipedItemSlot(16,70,456,“Primary”,Primary); so for example for the hand: equipedItemSlot(16,70,456,“Hand”,Hand);