Question by
Allin1gamer · Mar 05, 2017 at 09:36 PM ·
collison
How to delete cube when it hits the floor and play a particle
I would like this to delete the cube and replace it with particle animations using UnityEngine; using UnityEngine.SceneManagement;
public class Destroy : MonoBehaviour
{
#region Variables
// Public
//Private
[SerializeField]
#endregion
private ParticleSystem harardDustParticles;
private void OnCollisionEnter(Collision collision)
{
if(collision.gameObject.tag == "Floor1")
{
Destroy(Instantiate(harardDustParticles.gameObject, transform.position, Quaternion.identity), hazardDustParticles.startLifetime)
; this.gameObject.SetActive(false);
}
if(collision.gameObject.tag == "Player")
{
}
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612112530im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Object too fast for Collision in Unity 1 Answer
Player bounces off of enemy. Help!! 1 Answer
Enemy makes player glitch through walls 0 Answers
Player is Going Through Walls 2 Answers