I made a game where you can pick up objects and drop them into a fire, and with a script they got destroyed then, but now it doesn’t work anymore. I just saved it last time (when it worked) and now i started unity and nothing happens anymore when i drop something in the fire! Pls help!
Here’s the script which should destroy the objects:
using UnityEngine;
using UnityEngine.SceneManagement;
public class Dropped : MonoBehaviour
{
public bool isBurning = false;
public float BurnedCount = 0;
public string leveltoload;
public GameObject BurnParticels;
public void onTriggerEnter(Collider other)
{
if (other.CompareTag("Burnable"))
{
if (other.attachedRigidbody.isKinematic == false)
{
if (BurnedCount == 2)
{
SceneManager.LoadSceneAsync(leveltoload);
Debug.Log("Burned three things");
}
else
{
isBurning = true;
BurnedCount = BurnedCount + 1;
Destroy(other.gameObject);
}
}
}
if (other.CompareTag("Stone"))
{
if (other.attachedRigidbody.isKinematic == false)
{
isBurning = false;
Destroy(other.gameObject);
}
}
}
private void Awake()
{
DontDestroyOnLoad(gameObject);
}
private void Update()
{
if (isBurning)
{
BurnParticels.SetActive(true);
}
else
{
BurnParticels.SetActive(false);
}
}
}