Hi there, I am trying to add a slight delay to my brick destroying script. It works fine, But adding a slight delay to it I believe it will work perfect for what I am trying to achieve. Code (CSharp): public class Brick2D : Platform2D { public ParticleSystem particles; public BoxCollider2D myCollider; public MeshRenderer myRenderer; override public void DoAction(RaycastCollider2D collider, RaycastCharacterController2D character) { // Hitting from below if (collider.direction == RC_Direction.DOWN) { if (particles != null) particles.Play(); myCollider.enabled = false; myRenderer.enabled = false; } } } in Javascript its just a matter of adding in this. Code (JavaScript): yield WaitForSeconds(2.0); I understand in C# that yield is written with return new, but also it's supposed to be written with IEnumerator/Coroutines as well. I am not sure how to tie this all in together. I have been playing with it a fair bit now. Still no luck, could anyone point me in the right direction? Thank you
Ok, sorry I was too hasty - it looks like you want to preserve the object but just do some delayed processing. So just see this page it shows the C# usage of yield. Make sure you click the little c# button at the top right. You have to make the coroutine method an IEnumerator, then use "yield return new WaitForSeconds(x);"