SKScene Class

Definition

A scene of content in Sprite Kit. The root of a tree of Sprite Kit nodes.

[Foundation.Register("SKScene", true)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.WatchOS, 3, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.MacOSX, 10, 9, ObjCRuntime.PlatformArchitecture.Arch64, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 7, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public class SKScene : SpriteKit.SKEffectNode, GameplayKit.IGKSceneRootNodeType, IDisposable
type SKScene = class
    inherit SKEffectNode
    interface IGKSceneRootNodeType
    interface INativeObject
    interface IDisposable
Inheritance
Attributes
Implements

Remarks

The SKScene is the root of the scene-graph displayed by a SKView.

While being presented by a SKView (see PresentScene(SKScene, SKTransition)), the SKScene runs through an animation loop. Every pass through the loop involves:

The system restricts the animation loop to a maximum rate of 60Hz.

Constructors

SKScene()

Default constructor, initializes a new instance of this class.

SKScene(CGSize)

Creates a new SKScene of size, in points.

SKScene(IntPtr)

A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

SKScene(NSCoder)

A constructor that initializes the object from the data stored in the unarchiver object.

SKScene(NSObjectFlag)

Constructor to call on derived classes to skip initialization and merely allocate the object.

Properties

Alpha

Gets or sets the transparency for the node. 1.0 is opaque.

(Inherited from SKNode)
AnchorPoint

Gets or sets the point in the view that corresponds to the origin of the scene.

AttributeValues

Gets a dictionary of attribute values for the attached shader.

(Inherited from SKEffectNode)
AudioEngine

The AVAudioEngine used to play SKAudioNode audio.

BackgroundColor

Gets or sets the background color.

BlendMode

Gets or sets the blending mode for the effect.

(Inherited from SKEffectNode)
Camera

If not null, holds a SKCameraNode from which the SKScene may be rendered.

CanBecomeFocused (Inherited from SKNode)
Children

Gets the list of this node's child nodes.

(Inherited from SKNode)
Class (Inherited from NSObject)
ClassHandle

The handle for this class.

Constraints

Gets or sets the list of constraints that are applied to this node.

(Inherited from SKNode)
DebugDescription

A developer-meaningful description of this object.

(Inherited from NSObject)
Delegate

An instance of the SpriteKit.ISKSceneDelegate model class which acts as the class delegate.

Description

Description of the object, the Objective-C version of ToString.

(Inherited from NSObject)
Filter

Gets or sets the Core Image filter to use for the effect.

(Inherited from SKEffectNode)
FocusBehavior (Inherited from SKNode)
FocusItemContainer

Gets the container that manages focus information for child focus items.

(Inherited from SKNode)
Frame

Gets the rectangle, in the parent node's coordinate system, that contains only the current node.

(Inherited from SKNode)
Handle

Handle (pointer) to the unmanaged object representation.

(Inherited from NSObject)
HasActions

Gets a value that tells whether the node is currently running actions.

(Inherited from SKNode)
Hidden

Gets a value that tells whether the node and its descendants are rendered to the screen.

(Inherited from SKNode)
IsDirectBinding (Inherited from NSObject)
IsProxy (Inherited from NSObject)
Listener

For use with positioned SKAudioNode objects, this SKNode specifies the position of the person listening.

Menu (Inherited from NSResponder)
Name

Gets or sets the name that is used when searching for the node.

(Inherited from SKNode)
NextResponder (Inherited from NSResponder)
Parent

Gets this node's parent.

(Inherited from SKNode)
ParentFocusEnvironment

Gets the parent focus environment.

(Inherited from SKNode)
Paused

Gets or sets a value that causes this node and its descendants to be skipped when actions are processed for the scene. true causes them to be skipped.

(Inherited from SKNode)
PhysicsBody

Gets or sets the physics body, if any, that controls the node's position and rotation.

(Inherited from SKNode)
PhysicsWorld

Gets the physics world that is used to simulate physics in the scene.

Position

Gets or sets the node's position.

(Inherited from SKNode)
PreferredFocusedView (Inherited from SKNode)
PreferredFocusEnvironments (Inherited from SKNode)
ReachConstraints

Gets or sets the constraints that operate on the node for inverse kinematic reaching.

(Inherited from SKNode)
RetainCount

Returns the current Objective-C retain count for the object.

(Inherited from NSObject)
ScaleMode

Gets or sets the scale mode of the scene.

Scene

Gets the scene in which the node is processed.

(Inherited from SKNode)
Self (Inherited from NSObject)
Shader

Gets or sets the custom shader to use when blending the node into its parent's frame buffer.

(Inherited from SKEffectNode)
ShouldCenterFilter

Gets or sets a value that controls whether the filter's input center should be placed at the origin of the SKEffectNode.

(Inherited from SKEffectNode)
ShouldEnableEffects

Gets or sets a value that controls whether the effect is applied to its child node when they are draws.

(Inherited from SKEffectNode)
ShouldRasterize

Gets or sets a value that controls whether the node will cache filtered images.

(Inherited from SKEffectNode)
Size

Gets or sets the size of the scene.

Speed

Sets a value that controls the speed at which actions are run on the node. 1.0 corresponds to normal speed.

(Inherited from SKNode)
SubdivisionLevels (Inherited from SKEffectNode)
Superclass (Inherited from NSObject)
SuperHandle

Handle used to represent the methods in the base class for this NSObject.

(Inherited from NSObject)
TouchBar (Inherited from NSResponder)
UserActivity (Inherited from NSResponder)
UserData

Gets or sets the dictionary of values that the application developer can use to store custom data on the node.

(Inherited from SKNode)
UserInteractionEnabled

Gets or sets a value that controls whether the node responds to touch.

(Inherited from SKNode)
View

Gets or sets the view that the scene is presenting.

WarpGeometry (Inherited from SKEffectNode)
WeakDelegate

An object that can respond to the delegate protocol for this type

XScale

Gets or sets the scale factor for the X direction.

(Inherited from SKNode)
YScale

Gets or sets the scale factor for the Y direction..

(Inherited from SKNode)
Zone (Inherited from NSObject)
ZPosition

Gets or set the node's position in the Z direction.

(Inherited from SKNode)
ZRotation

Gets or sets the node's rotation about the Z axis.

(Inherited from SKNode)

Methods

AcceptsFirstResponder() (Inherited from NSResponder)
Add(SKNode)

Adds node to the end of the list of child nodes.

(Inherited from SKNode)
AddChild(SKNode)

Adds node to the end of the list of child nodes.

(Inherited from SKNode)
AddNodes(SKNode[])

Adds nodes to the end of the list of child nodes.

(Inherited from SKNode)
AddObserver(NSObject, NSString, NSKeyValueObservingOptions, IntPtr)

Registers an object for being observed externally (using NSString keyPath).   Observed changes are dispatched to the observer’s object ObserveValue(NSString, NSObject, NSDictionary, IntPtr) method.

(Inherited from NSObject)
AddObserver(NSObject, String, NSKeyValueObservingOptions, IntPtr)

Registers an object for being observed externally (using string keyPath).   Observed changes are dispatched to the observer’s object ObserveValue(NSString, NSObject, NSDictionary, IntPtr) method.

(Inherited from NSObject)
AddObserver(NSString, NSKeyValueObservingOptions, Action<NSObservedChange>)

Registers an object for being observed externally using an arbitrary method.

(Inherited from NSObject)
AddObserver(String, NSKeyValueObservingOptions, Action<NSObservedChange>)

Registers an object for being observed externally using an arbitrary method.

(Inherited from NSObject)
AwakeFromNib()

Called after the object has been loaded from the nib file. Overriders must call base.AwakeFromNib().

(Inherited from NSObject)
BecomeFirstResponder() (Inherited from NSResponder)
BeginGestureWithEvent(NSEvent) (Inherited from NSResponder)
BeginInvokeOnMainThread(Action) (Inherited from NSObject)
BeginInvokeOnMainThread(Selector, NSObject)

Invokes asynchrously the specified code on the main UI thread.

(Inherited from NSObject)
Bind(NSString, NSObject, String, NSDictionary) (Inherited from NSObject)
Bind(String, NSObject, String, NSDictionary) (Inherited from NSObject)
BindingInfo(String) (Inherited from NSObject)
BindingOptionDescriptions(String) (Inherited from NSObject)
BindingValueClass(String) (Inherited from NSObject)
CalculateAccumulatedFrame()

Calculates and returns the smallest rectangle that contains the node and all of its child nodes.

(Inherited from SKNode)
CommitEditing() (Inherited from NSObject)
CommitEditing(NSObject, Selector, IntPtr) (Inherited from NSObject)
ConformsToProtocol(IntPtr)

Invoked to determine if this object implements the specified protocol.

(Inherited from NSObject)
ContainsPoint(CGPoint)

Returns true if point is contained by the node, otherwise false.

(Inherited from SKNode)
ConvertPointFromNode(CGPoint, SKNode) (Inherited from SKNode)
ConvertPointFromView(CGPoint)

Converts point from the view's coordinate system to the scene's coordinate system.

ConvertPointToNode(CGPoint, SKNode) (Inherited from SKNode)
ConvertPointToView(CGPoint)

Converts point from the scene's coordinate system to the view's coordinate system.

Copy()

Performs a copy of the underlying Objective-C object.

(Inherited from NSObject)
Copy(NSZone)

Performs a copy of the underlying Objective-C object.

(Inherited from SKNode)
CursorUpdate(NSEvent) (Inherited from NSResponder)
DangerousAutorelease() (Inherited from NSObject)
DangerousRelease() (Inherited from NSObject)
DangerousRetain() (Inherited from NSObject)
DidApplyConstraints()

Method that is called after constraints are applied.

DidChange(NSKeyValueChange, NSIndexSet, NSString)

Indicates a change occurred to the indexes for a to-many relationship.

(Inherited from NSObject)
DidChange(NSString, NSKeyValueSetMutationKind, NSSet) (Inherited from NSObject)
DidChangeSize(CGSize)

Method that is called after the size of the scene changes.

DidChangeValue(String)

Indicates that a change occurred on the specified key.

(Inherited from NSObject)
DidEvaluateActions()

Method that is called after all scene actions are evaluated.

DidFinishUpdate()

Method that is called after the scene is updated.

DidHintFocusMovement(UIFocusMovementHint)

Called when the user's finger moves on the device or pad, to alert the Node that a focus change may occur.

(Inherited from SKNode)
DidMoveToView(SKView)

Method that is called after the scene is moved to view.

DidSimulatePhysics()

Method that is called after physics simulation is complete.

DidUpdateFocus(UIFocusUpdateContext, UIFocusAnimationCoordinator) (Inherited from SKNode)
Dispose()

Releases the resources used by the NSObject object.

(Inherited from NSObject)
Dispose(Boolean)

Releases the resources used by the SKScene object.

DoesNotRecognizeSelector(Selector)

Indicates that this object does not recognize the specified selector.

(Inherited from NSObject)
EncodeRestorableState(NSCoder) (Inherited from NSResponder)
EncodeRestorableState(NSCoder, NSOperationQueue) (Inherited from NSResponder)
EncodeTo(NSCoder)

Encodes the state of the object on the provided encoder

(Inherited from SKNode)
EndGestureWithEvent(NSEvent) (Inherited from NSResponder)
EnumerateChildNodes(String, SKNodeChildEnumeratorHandler)

Passes each child node that matches name, along with a reference to a boolean value, to enumerationHandler. App devs can set the referenced boolean value to true to stop iteration.

(Inherited from SKNode)
Equals(NSObject) (Inherited from NSObject)
Equals(Object) (Inherited from NSObject)
ExposedBindings() (Inherited from NSObject)
FlagsChanged(NSEvent) (Inherited from NSResponder)
FlushBufferedKeyEvents() (Inherited from NSResponder)
FromSize(CGSize)

Creates a scene of the specified size.

GetActionForKey(String)

Returns the action that is identified by key, or null if no action exists for the key.

(Inherited from SKNode)
GetBindingInfo(NSString) (Inherited from NSObject)
GetBindingOptionDescriptions(NSString) (Inherited from NSObject)
GetBindingValueClass(NSString) (Inherited from NSObject)
GetChildNode(String)

Searches for and returns the first node that is matched by name.

(Inherited from SKNode)
GetDictionaryOfValuesFromKeys(NSString[])

Retrieves the values of the specified keys.

(Inherited from NSObject)
GetEnumerator()

Returns an enumerator that iterates over the child nodes that belong to the current node.

(Inherited from SKNode)
GetHashCode()

Generates a hash code for the current instance.

(Inherited from NSObject)
GetMethodForSelector(Selector) (Inherited from NSObject)
GetNativeField(String) (Inherited from NSObject)
GetNativeHash() (Inherited from NSObject)
GetNewWindowForTab(NSObject) (Inherited from NSResponder)
GetNodeAtPoint(CGPoint)

Returns either the most deeply nested descendant that contains point, where point is specified in the current node's coordinate system.

(Inherited from SKNode)
GetNodesAtPoint(CGPoint)

Returns an array that contains all the child nodes that contain point, where point is specified in the current node's coordinate system.

(Inherited from SKNode)
GetObjectsMatching(String)

Returns an array that contains all the nodes that are matched by nameExpression.

(Inherited from SKNode)
GetValue(String)

Returns the attribute value for the specified key.

(Inherited from SKEffectNode)
HelpRequested(NSEvent) (Inherited from NSResponder)
Init() (Inherited from NSObject)
InitializeHandle(IntPtr) (Inherited from NSObject)
InitializeHandle(IntPtr, String) (Inherited from NSObject)
InParentHierarchy(SKNode)

Returns true if the current node is in the hierarchy below node.

(Inherited from SKNode)
InsertChild(SKNode, nint)

Inserts node at the position that is specified by index into the list of this node's children.

(Inherited from SKNode)
InterpretKeyEvents(NSEvent[]) (Inherited from NSResponder)
IntersectsNode(SKNode)

Returns true if the current node's frame intersects with the frame of the specified node, not counting the children of either node.

(Inherited from SKNode)
InvalidateRestorableState() (Inherited from NSResponder)
Invoke(Action, Double) (Inherited from NSObject)
Invoke(Action, TimeSpan) (Inherited from NSObject)
InvokeOnMainThread(Action) (Inherited from NSObject)
InvokeOnMainThread(Selector, NSObject)

Invokes synchrously the specified code on the main UI thread.

(Inherited from NSObject)
IsEqual(NSObject) (Inherited from NSObject)
IsEqual(SKNode) (Inherited from SKNode)
IsKindOfClass(Class) (Inherited from NSObject)
IsMemberOfClass(Class) (Inherited from NSObject)
KeyDown(NSEvent) (Inherited from NSResponder)
KeyUp(NSEvent) (Inherited from NSResponder)
MagnifyWithEvent(NSEvent) (Inherited from NSResponder)
MarkDirty()

Promotes a regular peer object (IsDirectBinding is true) into a toggleref object.

(Inherited from NSObject)
MouseDown(NSEvent) (Inherited from NSResponder)
MouseDragged(NSEvent) (Inherited from NSResponder)
MouseEntered(NSEvent) (Inherited from NSResponder)
MouseExited(NSEvent) (Inherited from NSResponder)
MouseMoved(NSEvent) (Inherited from NSResponder)
MouseUp(NSEvent) (Inherited from NSResponder)
MoveToParent(SKNode)

Changes the Parent of this SKNode to parent.

(Inherited from SKNode)
MutableCopy()

Creates a mutable copy of the specified NSObject.

(Inherited from NSObject)
NoResponderFor(Selector) (Inherited from NSResponder)
ObjectDidEndEditing(NSObject) (Inherited from NSObject)
ObserveValue(NSString, NSObject, NSDictionary, IntPtr)

Indicates that the value at the specified keyPath relative to this object has changed.

(Inherited from NSObject)
OtherMouseDown(NSEvent) (Inherited from NSResponder)
OtherMouseDragged(NSEvent) (Inherited from NSResponder)
OtherMouseUp(NSEvent) (Inherited from NSResponder)
PerformKeyEquivalent(NSEvent) (Inherited from NSResponder)
PerformSelector(Selector) (Inherited from NSObject)
PerformSelector(Selector, NSObject) (Inherited from NSObject)
PerformSelector(Selector, NSObject, Double)

Invokes the selector on the current instance and if the obj is not null, it passes this as its single parameter.

(Inherited from NSObject)
PerformSelector(Selector, NSObject, Double, NSString[]) (Inherited from NSObject)
PerformSelector(Selector, NSObject, NSObject) (Inherited from NSObject)
PerformSelector(Selector, NSThread, NSObject, Boolean) (Inherited from NSObject)
PerformSelector(Selector, NSThread, NSObject, Boolean, NSString[]) (Inherited from NSObject)
PrepareForInterfaceBuilder() (Inherited from NSObject)
PresentError(NSError) (Inherited from NSResponder)
PresentError(NSError, NSWindow, NSObject, Selector, IntPtr) (Inherited from NSResponder)
PressureChange(NSEvent) (Inherited from NSResponder)
QuickLook(NSEvent) (Inherited from NSResponder)
RemoveActionForKey(String)

Removes the action that is identified by key, if present.

(Inherited from SKNode)
RemoveAllActions()

Removes all the actions from the node.

(Inherited from SKNode)
RemoveAllChildren()

Removes all of the node's child nodes.

(Inherited from SKNode)
RemoveChildren(SKNode[])

Removes the specified list of nodes from the current node's list of child nodes.

(Inherited from SKNode)
RemoveFromParent()

Removes this node from its parent.

(Inherited from SKNode)
RemoveObserver(NSObject, NSString)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath.

(Inherited from NSObject)
RemoveObserver(NSObject, NSString, IntPtr)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath and context.

(Inherited from NSObject)
RemoveObserver(NSObject, String)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath.

(Inherited from NSObject)
RemoveObserver(NSObject, String, IntPtr)

Stops the specified observer from receiving further notifications of changed values for the specified keyPath and context.

(Inherited from NSObject)
ResignFirstResponder() (Inherited from NSResponder)
RespondsToSelector(Selector)

Whether this object recognizes the specified selector.

(Inherited from NSObject)
RestoreState(NSCoder) (Inherited from NSResponder)
RestoreUserActivityState(NSUserActivity) (Inherited from NSResponder)
RightMouseDown(NSEvent) (Inherited from NSResponder)
RightMouseDragged(NSEvent) (Inherited from NSResponder)
RightMouseUp(NSEvent) (Inherited from NSResponder)
RotateWithEvent(NSEvent) (Inherited from NSResponder)
RunAction(SKAction)

Adds an action to the node that will first be processed in the next animation loop.

(Inherited from SKNode)
RunAction(SKAction, Action)

Adds an action to the node that will be processed in the next animation loop, and calls completionHandler after the action completes.

(Inherited from SKNode)
RunAction(SKAction, String)

Adds an action to the node, accessible with the specified key, that will be processed in the next animation loop.

(Inherited from SKNode)
RunActionAsync(SKAction)

Adds an action to the node that will be processed in the next animation loop, and calls completionHandler after the action completes.

(Inherited from SKNode)
SceneDidLoad()
ScrollWheel(NSEvent) (Inherited from NSResponder)
SetNativeField(String, NSObject) (Inherited from NSObject)
SetNeedsFocusUpdate() (Inherited from SKNode)
SetNilValueForKey(NSString)

Sets the value of the specified key to null.

(Inherited from NSObject)
SetScale(nfloat)

Sets the X- and Y-scales to scale.

(Inherited from SKNode)
SetValue(SKAttributeValue, String)

Sets the attribute value at key to the provided value.

(Inherited from SKEffectNode)
SetValueForKey(NSObject, NSString)

Sets the value of the property specified by the key to the specified value.

(Inherited from NSObject)
SetValueForKeyPath(IntPtr, NSString)

A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

(Inherited from NSObject)
SetValueForKeyPath(NSObject, NSString)

Sets the value of a property that can be reached using a keypath.

(Inherited from NSObject)
SetValueForUndefinedKey(NSObject, NSString)

Indicates an attempt to write a value to an undefined key. If not overridden, raises an NSUndefinedKeyException.

(Inherited from NSObject)
SetValuesForKeysWithDictionary(NSDictionary)

Sets the values of this NSObject to those in the specified dictionary.

(Inherited from NSObject)
ShouldBeTreatedAsInkEvent(NSEvent) (Inherited from NSResponder)
ShouldUpdateFocus(UIFocusUpdateContext) (Inherited from SKNode)
ShowContextHelp(NSObject) (Inherited from NSResponder)
SmartMagnify(NSEvent) (Inherited from NSResponder)
SupplementalTargetForAction(Selector, NSObject) (Inherited from NSResponder)
SwipeWithEvent(NSEvent) (Inherited from NSResponder)
TabletPoint(NSEvent) (Inherited from NSResponder)
TabletProximity(NSEvent) (Inherited from NSResponder)
ToString()

Returns a string representation of the value of the current instance.

(Inherited from NSObject)
TouchesBeganWithEvent(NSEvent) (Inherited from NSResponder)
TouchesCancelledWithEvent(NSEvent) (Inherited from NSResponder)
TouchesEndedWithEvent(NSEvent) (Inherited from NSResponder)
TouchesMovedWithEvent(NSEvent) (Inherited from NSResponder)
TryToPerformwith(Selector, NSObject) (Inherited from NSResponder)
Unbind(NSString) (Inherited from NSObject)
Unbind(String) (Inherited from NSObject)
Update(Double)

Updates the scene to currentTime.

UpdateFocusIfNeeded() (Inherited from SKNode)
UpdateUserActivityState(NSUserActivity) (Inherited from NSResponder)
ValidRequestorForSendType(String, String) (Inherited from NSResponder)
ValueForKey(NSString)

Returns the value of the property associated with the specified key.

(Inherited from NSObject)
ValueForKeyPath(NSString)

Returns the value of a property that can be reached using a keypath.

(Inherited from NSObject)
ValueForUndefinedKey(NSString)

Indicates an attempt to read a value of an undefined key. If not overridden, raises an NSUndefinedKeyException.

(Inherited from NSObject)
WantsForwardedScrollEventsForAxis(NSEventGestureAxis) (Inherited from NSResponder)
WantsScrollEventsForSwipeTrackingOnAxis(NSEventGestureAxis) (Inherited from NSResponder)
WillChange(NSKeyValueChange, NSIndexSet, NSString)

Indicates that the values of the specified indices in the specified key are about to change.

(Inherited from NSObject)
WillChange(NSString, NSKeyValueSetMutationKind, NSSet) (Inherited from NSObject)
WillChangeValue(String)

Indicates that the value of the specified key is about to change.

(Inherited from NSObject)
WillMoveFromView(SKView)

Method that is called when the scene is about to move from view.

WillPresentError(NSError) (Inherited from NSResponder)

Explicit Interface Implementations

IEnumerable.GetEnumerator()

Internal.

(Inherited from SKNode)

Extension Methods

ValidateProposedFirstResponder(NSResponder, NSResponder, NSEvent)
ObjectDidBeginEditing(NSObject, INSEditor)
ObjectDidEndEditing(NSObject, INSEditor)
GetValidModes(NSObject, NSFontPanel)
ValidateToolbarItem(NSObject, NSToolbarItem)
GetTouchBar(NSResponder)
MakeTouchBar(NSResponder)
SetTouchBar(NSResponder, NSTouchBar)
QuickLookPreviewItems(NSResponder, NSObject)
PerformTextFinderAction(NSResponder, NSObject)
GetDebugDescription(INSObjectProtocol)
GetEntity(SKNode)
SetEntity(SKNode, GKEntity)
AcceptsPreviewPanelControl(NSObject, QLPreviewPanel)
BeginPreviewPanelControl(NSObject, QLPreviewPanel)
EndPreviewPanelControl(NSObject, QLPreviewPanel)
GetAccessibilityCustomRotors(NSObject)

Gets the array of UIAccessibilityCustomRotor objects appropriate for this object.

SetAccessibilityCustomRotors(NSObject, UIAccessibilityCustomRotor[])

Sets the array of UIAccessibilityCustomRotor objects appropriate for this object.

Applies to

See also