Howdy, im just about wrapping up a small demo game for my university course, and i need to set it so that when the enemy is killed it changes my scene, the enemy doesnt have a healthsystem or anything like that, when he is hit with the sword he is just destroyed.
I need some code that, upon his destruction/disbling, would then automatically move me to the next scene. Only issue is when i google it, it keeps coming up with either using buttons, which is irrelevant to my problem, or the code is old enough that unity doesnt actually work that way now.
just need to add it as a condition of the ‘if’ statement.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class enemyscript : MonoBehaviour
{
public GameObject Sword;
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "Sword");
{
Destroy(gameObject);
}
}
}