Hello all,
I'm having trouble with something very simple:
I want to reference a game object with it's own script.
public class ItemScript : MonoBehaviour
{
public Inventory inventory;
public ItemType type;
public Sprite spriteNeutral;
public Sprite spriteHighlight;
public int maxSize;
private void OnCollisionEnter (Collision other)
{
if (other.gameObject.tag == "Floor")
{
inventory.AddItem(this); //here I want it to add this item
LogManager.AddLine("Object is picked" + _________.name); //here I want it to get the name of this game object
Destroy(gameObject, 3);
}
}
Thanks
↧