Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load scenes into GodotWindow #8

Open
pluviamtonitrus opened this issue Jul 20, 2024 · 0 comments
Open

Load scenes into GodotWindow #8

pluviamtonitrus opened this issue Jul 20, 2024 · 0 comments

Comments

@pluviamtonitrus
Copy link

I'm trying to instantiate a PackedScene into a GodotWindow

let loadScene = { (subwindow: Window) -> () in
    if let scene: PackedScene = GD.load(path: "res://scene_2.tscn") {
        if let node: Node = scene.instantiate() {
            subwindow.addChild(node: node)
        }
    }
}

struct ContentView: View {
    @StateObject var app = GodotApp()
    
    var body: some View {
        VStack {
            GodotAppView()
            GodotWindow(callback: loadScene)
        }
        .padding()
        .environmentObject(app)
        .onAppear(perform: {
            app.createInstance(scene: "main.pck")
        })
    }
} 

but it causes GodotAppView to change its scene to scene_2.tscn as well.

Is there a way to run multiple scenes that are packed into a .pck file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant