- Home /
 
item pickup not working after an item is used.
I'm trying to fix this bug, but can't seem to find a solution. Whenever I have an item picked up & in my hotbar, I press 1-6 to instantiate the item into my player's hand, then press Q to equip/use it. For some reason, after I press Q, I am unable to pick up any items.
Here is the code from the hotbar:
         //keypress to bring item into player's hand
         if (Input.GetKeyDown(KeyCode.Alpha1))
         {
             
             if (currentlyEquipped != null)
             {
                 Destroy(currentlyEquipped);
             }
 
             //instantiate the item into the player's hand
             currentlyEquipped = Instantiate(slot1.GetComponent<InventorySlot>().item.Object, hand.position, hand.rotation, hand);
 
             //destroys collider so the player doesn't slide across the whole damn map
             if(currentlyEquipped.GetComponent<Collider>())
             {
                 currentlyEquipped.GetComponent<Collider>().enabled = false;
             }
 
             //set int to item selected, so it knows which one to equip
             hotItem = 1;
         }
         //equipping/using the item that's in the player's hand
         if (Input.GetKeyDown(KeyCode.Q) && hotItem == 1)
         {
             slot1.GetComponent<InventorySlot>().UseItem();
             Destroy(currentlyEquipped);
             item1 = prefab1;
             currentlyEquipped = null;
             hotItem = 0;
         }
 
               If needed, I will gladly post the code from my inventory/item system.
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
got a kind of health(battery) pickup, that doesnt work 1 Answer
Bugs in a pick up items script. 2 Answers
Adding Item to an Inventory. 1 Answer