how can i trigger coroutine once that not repeat.

when i enter the trigger object it would play the cutscene but when i exit the trigger it will trigger again the cutscene even i’m not in the trigger area look like loop from coroutine

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class activateCutscene : MonoBehaviour
{

    public GameObject Camera1;
    public GameObject Camera2;
    public GameObject Camera3;
    public GameObject FO;
    public GameObject FI;
    public GameObject Player;
    private bool scene = false;

    // Use this for initialization
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player" && ! scene)
        {
            scene = true;
            StartCoroutine(cutscenestart());
        }
    }
    IEnumerator cutscenestart()
    {
        while (true)
        {
            yield return new WaitForSeconds(5);
            Camera2.SetActive(true);
            Camera1.SetActive(false);
            FI.SetActive(false);
            yield return new WaitForSeconds(10);
            Camera3.SetActive(true);
            Camera2.SetActive(false);
            yield return new WaitForSeconds(4);
            FO.SetActive(true);
            yield return new WaitForSeconds(1);
            Player.SetActive(true);
            FI.SetActive(true);
            FO.SetActive(false);
            Camera3.SetActive(false);
            yield return null;
        }

    }

}

i would like to trigger it once i already put “yield return null” but it’s the same. it’s from JimmyVegas Youtube Tutorial :slight_smile:

Remove while(true)