TileUpdateMode

public enum TileUpdateMode : UInt8

The TileUpdateMode enumeration dictates how the tilemap updates its tiles in your scene. Changing this property can drastically affect your CPU usage, so use it carefully.

The default mode is TileUpdateMode.actions, which should be used for the best performance. In this mode, animated tiles are animated with SpriteKit actions.

If full mode is used, each tile (animated or otherwise) is updated every frame. This ensures accuracy in syncronizing frames.

Important

If dynamic or full mode is selected, the SKTilemap node must be included in your scene’s main update loop to render properly.

Usage

// passing the tile update mode to the load function
if let tilemap = SKTilemap.load(tmxFile: "MyFile.tmx", updateMode: TileUpdateMode.dynamic) {
    scene.addChild(tilemap)
}

// updating the attribute on the tilemp node
tilemap.updateMode = TileUpdateMode.actions

Properties

  • dynamic: dynamically update tiles as needed.
  • full: all tiles are updated each frame.
  • actions: tiles are not updated, SpriteKit actions are used instead.

Extensions

  • Returns an array of all tile update modes.

    Declaration

    Swift

    public static func allModes() -> [TileUpdateMode]

    Return Value

    array of all tile update modes.

  • Returns the next tile update mode.

    Declaration

    Swift

    public func next() -> TileUpdateMode

    Return Value

    next update mode.

  • Control string to be used with the render stats menu.

    Declaration

    Swift

    public var uiControlString: String { get }