if 20 objects are destroyed...

I’d like to write a script in which once twenty block are destroyed a particle event is triggered. I’m just having a hard time figuring out the simplest way to write it. Any ideas?



Well, the simplest way would just be to increment a static value every time you call the Destroy() on the blocks.

using UnityEngine;
using System.Collections;

public class blockCounter : MonoBehaviour {

	public static int blocksDestroyed = 0;

        void Update()
            if( blocksDestroyed == 20 )
                // Play particle effect here;

From your other scripts before you call Destroy():

blockCounter.blocksDestroyed += 1;
Destroy( gameObject);