When I pick up an item, the item spawns directly next to my inventory slot instead of inside of the inventory box. Any idea as to what I am doing wrong?
[175608-inventory.png*_|175608]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ItemPickUp : MonoBehaviour
{
private Inventory inventory;
public GameObject itemButton;
private void Start()
{
inventory = GameObject.FindGameObjectWithTag("Player").GetComponent<Inventory>();
}
private void OnTriggerEnter2D(Collider2D other)
{
if(other.CompareTag("Player"))
{
for (int i = 0; i < inventory.slots.Length; i++)
{
if (inventory.isFull *== false)*
{
inventory.isFull = true;
Instantiate(itemButton, inventory.slots*.transform, false);*
//Instantiate(itemButton, inventory.slots*.transform, false);*
//Instantiate(newItem, Slots[0].position, Slots[0].rotation);
Destroy(gameObject);
break;
}
}
}
}
}
_*