Explosion FX

Hay there I made it with defrant way
would like to know if it follow the good practice or not?

here is the code :

public class CollisionHandler : MonoBehaviour
{
public float timeDelay = .5f;
public GameObject masterTimeline;
public ParticleSystem explosion;

private void OnTriggerEnter(Collider other)
{
    Chashing();
}

void Chashing()
{
    gameObject.SetActive(false);
    masterTimeline.SetActive(false);
    Instantiate(explosion, transform.position, transform.rotation);
    Invoke(nameof(ReLoadLevel), timeDelay);
}

void ReLoadLevel()
{
   
    gameObject.GetComponent<Playercontrols>().enabled = false;
    SceneManager.LoadScene(0);
}

}
and screenchot for the editor :

3 Likes

Boom awesome job!

1 Like

Thanks :blush::blush:

1 Like

Haha you’re welcome :innocent:

1 Like

nice effect - I rather like it for a “light speed” jump too :slight_smile:

1 Like

You are genious!Thanks to you my code now is working!

1 Like

Privacy & Terms