EndFlag

PHOTO EMBED

Mon Jan 13 2025 05:16:40 GMT+0000 (Coordinated Universal Time)

Saved by @iliavial #c#

using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.SceneManagement;

public class EndFlag : MonoBehaviour
{
    public string nextSceneName;
    public bool lastLevel;

    private void OnTriggerEnter (Collider other)
    {
        if(other.CompareTag("Player"))
        {
            if(lastLevel == true)
            {
                SceneManager.LoadScene(0);
            }
            else
            {
                SceneManager.LoadScene(nextSceneName);
            }
        }
    }
}
content_copyCOPY