public int itemAdd; // creates counter that can be passed to player control; add amount in inspector
void OnTriggerEnter2D(Collider2D other)
{
//this "if" statement confirms that only the player will be allowed to pick the object up (this is assuming the player script is called "PlayerControl")
//this is needed in case monsters who also may ahve the box collider2d component, will not pick up the item
if (other.GetComponent <PlayerControl>() == null)
{
return;
}
PlayerControl.AddPoints(itemAdd); // on collison, will add the amount in player script
Destroy(gameObject); //destroys the object
}