SceneView not loading .usdz model until I tap it

34 views Asked by At

I have a SceneView that's not loading/displaying my 3D model until I tap inside it. Any idea why this could be happening? Could there be a problem regarding the .usdz file?

Here's the code:

List{
    Section {
        VStack(alignment: .leading){
            HStack{
                Image("characterAvatar")
                    .resizable()
                    .frame(width: 72, height: 72)
                    .background(Color(.systemGray3))
                    .clipShape(Circle())
                VStack(alignment: .leading, spacing: 4){
                    Text(User.MOCK_USER.username)
                        .font(.subheadline)
                        .fontWeight(.semibold)
                        .padding(.top, 4)
                    Text(User.MOCK_USER.email)
                        .font(.footnote)
                        .foregroundColor(.gray)
                }
            }
            SceneView(scene: {
                let scene =  SCNScene(named:"character.usdz")!
                scene.background.contents = UIColor(
                    red: 28.0/255.0,
                    green: 28.0/255.0,
                    blue: 30.0/255.0,
                    alpha: 1.0
                )
                
                return scene
            }(),options: [.autoenablesDefaultLighting,.allowsCameraControl])
            .frame(width: UIScreen.main.bounds.width - 60, height: UIScreen.main.bounds.height / 4)
        }
    }
}

SceneView not loading

0

There are 0 answers