Пример #1
0
    private void SpawnItem()
    {
        int    size      = itemList.Count;
        Random random    = new Random();
        int    randomNum = UnityEngine.Random.Range(0, size);

        string itemName = itemList.ElementAt(randomNum);

        Debug.Log(randomNum);
        ItemPickup pickup = FindObjectOfType <ItemPickup>();

        if (pickup != null)
        {
            spawned = true;
            pickup.makeItem(itemName, -1, transform.position, new Vector2(0, -2));
        }
    }