How to ensure that an additively loaded scene is active before it becomes interactive?

I’m using the following code to load a scene additively that’s supposed to become the active scene:

SceneManager.LoadScene(scene, LoadSceneMode.Additive);
yield return null;
SceneManager.SetActiveScene(SceneManager.GetSceneByName(scene));

(scene is a string containing the name of the scene)

problem is, the scene can contain buttons that should only be clickable once the scene is actually the active scene. the way it is, the scene starts inactive and then becomes active. i want the scene to only show up when it’s already active.

any way to do that?

not super happy with it, but i’ve now done it this way:

changed my scene-loading-script from the three lines in the question to:

SceneManager.LoadScene(scene, LoadSceneMode.Additive);
yield return new WaitUntil(() => SceneManager.GetActiveScene().name == scene);

(the yield return because callers need to be able to wait until the loading is complete)

then made following script:

using UnityEngine;
using UnityEngine.SceneManagement;

public class ActivateScene : MonoBehaviour {
	void Start() {
        bool wasLoaded = SceneManager.SetActiveScene(gameObject.scene);
        Debug.Assert(wasLoaded);
    }
}

had to use Start because Awake and OnEnable are both called before scene is considered loaded.

added ActivateScene to Script Execution Order settings and put it before Default Time.

then of course, added an ActivateScene-component to every scene that needs to be auto-activated.

if anyone knows a better way, please let me know.