Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Not sure how to make a collectible...

currently following this tutorial, and I'm not sure what I've done wrong with my code. I'm not getting any errors. I should also mention that I'm doing mine in 2D, not 3D, and using Box Collider 2D instead of the regular collider.


using System.Collections;

using System.Collections.Generic;

using UnityEngine;


public class CoinPickup : MonoBehaviour

{

  // Update is called once per frame

  void OnTriggerEnter(Collider info)

  {

    if (info.tag == "Player")

    {

      Debug.Log("it worked!");

      Destroy(gameObject);

    }

  }

}

Sign In or Register to comment.