Set AsyncOperation.allowSceneActivation from another script ?

Hi guys !
I’d like to be able to delay the scene activation but I just can’t get to call alloSceneActivation from another script :confused:

I guess I just don’t know how to get a reference to the proper async operation that is waiting for activation here !

Any help would be great :smiley:

if you need any help leave a comment below
so basically i have a separate scene (loading scene)
which has the below script attached to it

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class LoadingSceneController : MonoBehaviour {
	
	[Header("Loading Visuals")]
	public Image background;
	public Image progressBar;
	public Image fadeOut;
	public Text loadingText;
	[Header("Timing Settings")]
	public float waitOnLoadEnd;
	[Header("Loading Settings")]
	public ThreadPriority loadThreadPriority;

	AsyncOperation operation;

	public static int loadingSceneIndex = 1;
	public static string sceneNameToLoad = "";
	public static int sceneIndexToLoad = -1;

	void Start()
	{
		GetComponent<AudioSource> ().volume = Volume_Controller.get_sfx_volume();
		Debug.Log (sceneNameToLoad);
		Debug.Log ("Loading scene is loaded");
		StartCoroutine (CoLoadSceneAsyncByName ());
	}
	public static void LoadSceneByName(string sceneName)
	{
		Application.backgroundLoadingPriority = ThreadPriority.High;
		SceneManager.LoadScene(loadingSceneIndex);
		sceneNameToLoad = sceneName;
	}
	public static void LoadSceneByIndex(int sceneIndex)
	{
		Application.backgroundLoadingPriority = ThreadPriority.High;
		SceneManager.LoadScene(loadingSceneIndex);
		sceneIndexToLoad = sceneIndex;
	}
	IEnumerator CoLoadSceneAsyncByName()
	{
		InitializeVisuals ();
		yield return null;

		Application.backgroundLoadingPriority = loadThreadPriority;

		operation = SceneManager.LoadSceneAsync (sceneNameToLoad);

		while (!operation.isDone) 
		{
			progressBar.fillAmount = operation.progress;
			yield return null;
		}
		yield return new WaitForSeconds (waitOnLoadEnd);

		LoadingDone ();

		yield return new WaitForSeconds (0.1f);
		operation.allowSceneActivation = true;
	}
	public void InitializeVisuals()
	{
		progressBar.fillAmount = 0f;
		loadingText.text = "Loading...";
	}
	public void LoadingDone()
	{
		progressBar.fillAmount = 1f;
		loadingText.text = "Loading Done.";
	}

}