'SWIFT: Load different reality Scenes via Variable

So, i am trying to load different Scenes made in RealityComposer, depending on a variable.

What worked so far:

let SceneAnchor = try! Experience1.loadScene()
arView.scene.anchors.append(SceneAnchor)
return arView

Now i looked into apples Documentation and saw the possibility of:

    if let anchor = try? Entity.loadAnchor(named: "Scene") {
        arView.scene.addAnchor(anchor)
    }

where i thought i could just change "Scene" to "Scene(myVar)" But once i have more than one scene in my file the first solution doesnt work anymore and the second one doesnt work as well.

What am i missing?

I also looked into working with filenames and was able to make an array of all my .reality Files and Store them in an Array, so i thought i could recall that via the index, but arrayName[1].loadScene() doesnt seem to work either, eventhough i can print the filenames to console.

Thanks in advance :)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source