Instance Method

sceneWithOptions:error:

Instantiates a scene from the scene source with the specified options.

Declaration

- (SCNScene *)sceneWithOptions:(NSDictionary<SCNSceneSourceLoadingOption, id> *)options error:(NSError * _Nullable *)error;

Parameters

options

A dictionary containing options that affect scene loading. See Scene Loading Options for available keys and values. Pass nil to use default options.

error

A pointer to an error object. If loading fails, the method returns nil and this pointer references an NSError object describing the error. Pass nil if you do not want error information.

Return Value

An SCNScene object containing the entire scene graph from the scene source, or nil if loading was not successful.

Discussion

Calling this method is equivalent to calling sceneWithOptions:statusHandler: with a block that checks its error parameter to see whether the status is SCNSceneSourceStatusError. To load a scene without creating a scene source object, use the SCNScene method sceneWithURL:options:error:.

A scene source can contain objects that are not part of its scene graph. To obtain these objects, you must load them individually with the the entryWithIdentifier:withClass: or entriesPassingTest: method. For example, a scene file containing a game character could include several animations for the character geometry (such as running, jumping, and standing idle). Because you typically do not apply multiple animations at once, the scene file contains these animations without their being attached to the character geometry.

See Also

Loading a Complete Scene

- sceneWithOptions:statusHandler:

Loads the entire scene graph from the scene source and calls the specified block to provide progress information.