Loads a scene from a file with the specified name in the app’s main bundle.
- iOS 8.0+
- macOS 10.9+
- tvOS 9.0+
- watchOS 2.0+
The name of a scene file in the app bundle’s resources directory.
A new scene object, or
nil if no scene could be loaded.
This method provides a convenient way to load a complete scene from a file in the app’s main bundle. Calling this method is equivalent to using the
Bundle class to locate the scene file and passing the resulting URL to the
init(url: method, specifying no options and no error handling.
For more detailed options or to load only part of a file’s scene graph, use the
When creating a scene using Xcode's Scene Editor or an external tool, you should copy your scene file into a directory with the .scnassets extension inside your app bundle. You should also place any image files referenced as textures from that scene in an Asset Catalog. Xcode will optimize the scene and texture resources for best performance on each target device, and prepare your texture resources for delivery features such as App Thinning and On-Demand Resources.