Same here, despite what the Release Notes say.
Post
Replies
Boosts
Views
Activity
I have the same problem. In order to change the scn file, I have to open Xcode 11. I hope this is fixed on the next Xcode 12 beta.
For Xcode 12b2 (12A6163b), this issue still exists. Changing the scn file will result in a modal, "The document "filename.scn" could not be autosaved." And this means that the only way to exit Xcode 12 is to force-quit.
This is a known issue with the Xcode 12 betas and one that the Apple Graphics and Games team has said will be fixed in an upcoming Xcode 12 beta. Unfortunately, it didn't make it into Xcode 12b2.
The other thread on which this is being discussed is here: https://developer.apple.com/forums/thread/650255.
Here's hoping the fix will make it into Xcode 12b3.
Xcode 12b3 fixes the problem of not being able to save changes in Xcode 12. Thank you everyone in Apple's Graphics and Games Engineer team!
Just one teeny favor from the Graphics and Games Engineer; sometime could someone post a best-practices on moving cameras and other Scene changes? Just worried that what I'm doing to get the desirable outcome may not be the best way. Thanks.
Sorry about that. The period somehow was included in the link. The link is https://developer.apple.com/forums/thread/650255
The good news is that this issue has been fixed in Xcode12b3.
I just want to add that running the above code on an iPhone 11 (iOS 14b3) results in a very bad user-experience with a frame rate of 2 fps. So, either I'm doing something horribly wrong, which is likely, or else SceneView may not be ready for prime-time, which would be sad.
Bug report filed: https://feedbackassistant.apple.com/feedback/8229356
I feel your pain. I have been unable to get the DTK and my LG 5K UltraFine (27MD5KL) to work together. Talk about Black Screen of Death.
How might one extend an existing reference type, say SCNScene, to conform to ObservableObject?
So, can't edit or correct my own previous posts. Nice!
The above code of mine obviously doesn't work. Worse, it's bad code. Junk, really.
There are a couple of ways to handle creating an "aircraftScene" instance of SCNScene, @StateObject and doing a copy( ). I chose, after talking asking friends more experienced than me for their advice, to use @StateObject implementation of the "aircraftScene". But guess what?!? Apple didn't change SCNScene to conform to ObservedObject like it did for . So one needs to extend SCNScene to conform to ObservableObject in order to use the @StateObject property wrapper on an instance of SCNScene.
Unfortunately, this extension of SCNScene as an ObservableObject does not synthesize the objectWillChange publisher, which would emit a value change before any of its @Published properties changed.
Below is the simplified version of what I've done. This works. But not well. The performance never exceeds 53 fps and so can't be used for production sims or games.
If you find something amiss, which I'm sure you will, please post it here.
import SwiftUI
import SceneKit
extension SCNScene: ObservableObject {
}
struct SwiftUISceneKitUsingStateObjectVarsContentView: View {
		@State private var sunlightSwitch	 = true
		@State private var magnify					= CGFloat(1.0)
		@StateObject var aircraftScene			= SCNScene(named: "art.scnassets/ship.scn")!
		var body: some View {
				ZStack {
						Color.black.edgesIgnoringSafeArea(.all)
						SceneView (
								scene: aircraftScene,
								pointOfView: aircraftScene.rootNode.childNode(withName: "distantCameraNode", recursively: true)
						)
						.background(Color.black)
						.gesture(MagnificationGesture()
												.onChanged{ (value) in
														print("magnify = \(self.magnify)")
														self.magnify = value
														let camera = self.aircraftScene.rootNode.childNode(withName: "distantCameraNode", recursively: true)?.camera
														camera!.fieldOfView /= magnify
												}
												.onEnded{ _ in
														print("Ended pinch\n\n")
												}
						)
						VStack() {
								Text("Hello, SceneKit!").multilineTextAlignment(.leading).padding()
										.foregroundColor(Color.gray)
										.font(.largeTitle)
								Text("Pinch to zoom.")
										.foregroundColor(Color.gray)
										.font(.title)
								Text("Magnification: \(magnify, specifier: "%.2f")")
										.foregroundColor(Color.gray)
										.font(.title3)
										.padding()
								Text("FOV: \((self.aircraftScene.rootNode.childNode(withName: "distantCameraNode", recursively: true)?.camera!.fieldOfView)!, specifier: "%.2f")")
										.foregroundColor(Color.gray)
										.font(.title3)
								Spacer(minLength: 300)
								Button( action: {
										withAnimation{
												self.sunlightSwitch.toggle()
										}
										let sunlight = self.aircraftScene.rootNode.childNode(withName: "sunlightNode", recursively: true)?.light
										if self.sunlightSwitch == true {
												sunlight!.intensity = 2000.0
										} else {
												sunlight!.intensity = 0.0
										}
								}) {
										Image(systemName: sunlightSwitch ? "lightbulb.fill" : "lightbulb")
												.imageScale(.large)
												.accessibility(label: Text("Light Switch"))
												.padding()
								}
						}
				}
				.statusBar(hidden: true)
		}
}
So, let's say you want to swap between cameras, provided you have more than one, in a scene. I banged my head on this for a bit of time, primarily because I'm either dim-witted (a real strong possibility) or just too set in my 57-year old ways, trying to change the pointOfView property in SceneView. Eventually, it hit me that all I'm trying to do is change the "withName" String in .childNode(withName: String, recursively: Bool). And boy!, that's easy.
The above code I posted is junk and, frankly, embarrassing. Here's the better code. I hope it helps.
import SwiftUI
import SceneKit
extension SCNScene: ObservableObject {
}
struct SwiftUISceneKitUsingStateObjectVarsContentView: View {
		@State private var povSwitch				= true
	@State private var pointOfView			= "distantCamera"
		@StateObject var aircraftScene			= SCNScene(named: "art.scnassets/ship.scn")!
		var body: some View {
				ZStack {
						Color.black.edgesIgnoringSafeArea(.all)
						SceneView (
								scene: aircraftScene,
								pointOfView: aircraftScene.rootNode.childNode(withName: pointOfView, recursively: true)
						)
						.background(Color.black)
						VStack() {
								Text("Hello, SceneKit!").multilineTextAlignment(.leading).padding()
										.foregroundColor(Color.gray)
										.font(.largeTitle)
								Text("Change the camera.")
										.foregroundColor(Color.gray)
										.font(.title)
								Spacer(minLength: 300)
								Button( action: {
										withAnimation{
												self.povSwitch.toggle()
										}
										 if self.povSwitch == true {
												self.pointOfView = "distantCamera"
										} else {
												self.pointOfView = "aircraftCamera"
										}
								}) {
										Image(systemName: sunlightSwitch ? "video.fill" : "video")
												.imageScale(.large)
												.accessibility(label: Text("Camera Switch"))
												.padding()
								}
						}
				}
				.statusBar(hidden: true)
		}
}
I posted this on another post dealing with MagnificationGesture, but frankly, it's more appropriate here. Here's how to swap between two cameras in a scene, "distantCamera" and "aircraftCamera".
import SwiftUI
import SceneKit
extension SCNScene: ObservableObject {
}
struct SwiftUISceneKitUsingStateObjectVarsContentView: View {
		@State private var povSwitch				= true
	@State private var pointOfView			= "distantCamera"
		@StateObject var aircraftScene			= SCNScene(named: "art.scnassets/ship.scn")!
		var body: some View {
				ZStack {
						Color.black.edgesIgnoringSafeArea(.all)
						SceneView (
								scene: aircraftScene,
								pointOfView: aircraftScene.rootNode.childNode(withName: pointOfView, recursively: true)
						)
						.background(Color.black)
						VStack() {
								Text("Hello, SceneKit!").multilineTextAlignment(.leading).padding()
										.foregroundColor(Color.gray)
										.font(.largeTitle)
								Text("Change the camera.")
										.foregroundColor(Color.gray)
										.font(.title)
								Spacer(minLength: 300)
								Button( action: {
										withAnimation{
												self.povSwitch.toggle()
										}
										 if self.povSwitch == true {
												self.pointOfView = "distantCamera"
										} else {
												self.pointOfView = "aircraftCamera"
										}
								}) {
										Image(systemName: povSwitch ? "video.fill" : "video")
												.imageScale(.large)
												.accessibility(label: Text("Camera Switch"))
												.padding()
								}
						}
				}
				.statusBar(hidden: true)
		}
}
All through the watchOS 7 betas, I didn’t experience any watch battery issues on either of the 2 Apple Watch Series 5’s I have. But after I updated both to release watchOS 7, both are experiencing at least a 2x rate of battery drain. Am barely able to get from 8am to 10 pm without a recharge. What in the world happened between the last watchOS beta and GM to cause this?
I’ll throw-in my 2¢ worth; editing xcdatamodeld was fine until Xcode 12.2b2 and Big Sur latest beta.