Why can't I destroy this object!?

I’m trying to Destroy my object but it won’t work!! Please Help! ;-;

Here is the code:

using System.Collections;

using UnityEngine;
using System.Collections;

public class Strawberries : MonoBehaviour {

	    public int score = 0;

	    // Use this for initialization
	    void Start () {

		    }

	    // Update is called once per frame
	    void Update () {

		    }

	    void OnTriggerEnter2D(Collider2D other){
		        Debug.Log ("Triggered"); 
		        Destroy (gameObject);
		    }
}

Does The Debug.Log(“Triggered”) Work? If Not, Then The OnTriggerEnter2D Doesn’t Get Called Because Of 2 Reasons:

  1. If The “Is Trigger” Isn’t Set To True On The Collider That Has The “Strawberries” Script.
  2. If The Other Object That Enters This Collider Hasn’t A Rigidbody2D Attached To It.

So You Need To Have A “Rigidbody2D” Attached To The GameObject That Enters The Collider Of This GameObject That Holds “Strawberries” Script.

Hope It Helps.

try this.

         void OnTriggerEnter2D(Collider2D other){
                 Debug.Log ("Triggered"); 
                 Destroy (this.gameObject);
             }

or you can try to attach the script on other object (your player in colliding with) and then do what @tmalhassan said.

and if this Debug.Log (“Triggered”); is not printing anything on Console then you might have another error can you post a screenshot of your console or you can cross check if the gameobject is not being effected by any other object or reference to any other script and forcing it not to destroy for some reason.

You need to check whether you are destroying the gameObject with the Collider…
If it is the parent or child object you want to destroy…