Contents

runAction(_:completionHandler:)

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

Declaration

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

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