Skip to content

apparata/EntityTreeInspector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EntityTreeInspector

A SwiftUI window that lets the user inspect a snapshot of a RealityKit entity tree.

To refresh the snapshot, use pull to refresh.

License

See LICENSE file for license information.

What Does It Look Like?

Screenshot of Entity Tree Inspector

How To

First add the window scene to your SwiftUI app.

@main 
@MainActor struct MyApp: App {

    @Struct private var myModel: MyModel

    var body: some SwiftUI.Scene {

        // Debugging window showing the entity tree.
        EntityTreeWindow {
            // Return the root entity of your entity tree here.
            myModel.rootEntity
        }
    }
}

Then in a view in your app, open the window with the open window action.

struct MyView: View {
    
    @Environment(\.openWindow) private var openWindow
    
    var body: some View {
        Button {
            openWindow(id: EntityTreeWindow.id)
        } label: {
            Text("Open Entity Tree Inspector")
        }
    }
}