How Can I make items inventory? (HELP)
Hello,
I have 5 slots (called orders) that I want them to get the Image of a prefab. So Far I made this:
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class ordermenu : MonoBehaviour { public bool[] isFull; public GameObject[] slots; private float nextActionTime = 0.0f; public float period = 10f; public GameObject item;
 void Update()
 {
     if (Time.time > nextActionTime)
     {
         nextActionTime += period;
         for (int i = 0; i < slots.Length; i++)
         {
             if (isFull[i] == false)
             {
                 isFull[i] = true;
                 Instantiate(item, slots[i].transform, false);
                 Destroy(item);
                 break;
             }
         }
         Debug.Log(nextActionTime);
     }
 }
}
It does not work as I want it to. I want: - to Have let's say 5 prefabs that do not appear on the screen and every some specific time they show up on the orders images (5 order images). - to be able to re-use the prefabs - the prefab that shows up in the image to be random (from the 5 choices) - The Orders to be only five at a time (max 5)


Your answer
 
 
             Follow this Question
Related Questions
IPointerExitHandler while holding click 0 Answers
Change the dropping prefab for each in-game drop 1 Answer
Zelda-like inventory system 0 Answers
Why is drag and drop not working? 1 Answer
Canvas Inventory closing 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                