Hey Guys, i have an Error in my Script and i hope you can help me…
It was in the first line:
if(hit.transform.tag == "Item" && distance <= 3 && hit.transform.GetComponent<DroppedItem>().item)
{
inventoryscript.addExistingItem(hit.transform.GetComponent<DroppedItem>().item);
Destroy (hit.transform.gameObject);
}
Before i had this Error i added this line : && hit.transform.GetComponent().item)
But Before i added this Line i had an Object Reference Error when i pick something up.
So, i don´t know further. Hope you can help me to fix this.
By the Way: It´s a Script to Pickup Items and DroppedItem is a Script.