Can't access AsyncOperation instance to change allowSceneActivation

I’m trying to load a scene in the background, initially setting allowSceneActivation to false, then setting it to true once a button is placed. When I try to set it to true, though, Unity gives me an error, saying ‘Object reference not set to an instance of an object’. the variable in question is, indeed set to an instance, though, in the Start function:

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

public class GameLauncher : MonoBehaviour {
    AsyncOperation async;

    // Use this for initialization
    void Start () {
        //load other scene in background
        //connect to server in background

    public IEnumerator loadScene()
        async = SceneManager.LoadSceneAsync(1, LoadSceneMode.Single);
        async.allowSceneActivation = false;
        yield return null;

here’s where I get the error:

	public void Connect () {
        //finish connection when button is pressed
        async.allowSceneActivation = true;

I don’t get why thIs assignment in the loadScene coroutine doesn’t count? Is the Connect function being public somehow responsible? It’s hard to troubleshoot, since Unity crashes every time I fail to finish the scene load…

Just a guess - try using LoadSceneMode.Additive ? Your script and further execution is removed as soon ad the new scene using LoadSceneMode.Single is loaded (because it resides in your previous scene).

The problem as stated isn’t reproducible, it was a misunderstanding.