Instance Method

runAction(_:completionHandler:)

Adds an action to the list of actions executed by the node. SceneKit calls the specified block when the action completes.

Required.

Declaration

func runAction(_ action: SCNAction, completionHandler block: (() -> Void)? = nil)

Parameters

action

The action to be performed.

block

A completion block that SceneKit calls when the action completes.

Discussion

The new action is processed the next time SceneKit prepares to render a frame.

SceneKit calls your block after the action’s duration is complete. For example, in a game you could use this method to show a Game Over message after performing a fade-out action on a node that displays a player character.

See Also

Running Actions

func runAction(SCNAction)

Adds an action to the list of actions executed by the node.

Required.

func runAction(SCNAction, forKey: String?)

Adds an identifiable action to the list of actions executed by the node.

Required.

func runAction(SCNAction, forKey: String?, completionHandler: (() -> Void)?)

Adds an identifiable action to the list of actions executed by the node. SceneKit calls the specified block when the action completes.

Required.