Created
July 9, 2023 17:03
-
-
Save mr-brooks-dev/b5b32020882a3e377f15fd6e7695622f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public class MeltObject : MonoBehaviour | |
| { | |
| public GameObject particlePrefab; | |
| public string targetTag = "Lava"; | |
| public float objectDestroyDelay = 1f; | |
| private void OnCollisionEnter(Collision collision) | |
| { | |
| if (collision.gameObject.CompareTag(targetTag)) | |
| { | |
| Instantiate(particlePrefab, transform.position, transform.rotation); | |
| Destroy(gameObject, objectDestroyDelay); | |
| } | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Super simple Unity script for instantiating a flame particle prefab and then destroy the object the script is attached to.