using System.Collections; using System.Collections.Generic; using UnityEngine; public class InvScript : MonoBehaviour { public GameObject Player; public GameObject HeldItem; // Pick up an item when called public void PickupItem(GameObject ToPickUp) { // if the held item is null the pickup up - else drop what is been held if (HeldItem == null) { HeldItem = ToPickUp; HeldItem.name = ToPickUp.name; ToPickUp.SetActive(false); } //else //{ // DropItem(); //} } // Drops the item when called public void DropItem() { HeldItem.transform.position = Camera.main.transform.GetChild(0).position; Camera.main.transform.GetChild(0).gameObject.SetActive(false); HeldItem.SetActive(true); HeldItem = null; } }