TileUpdateMode

public enum TileUpdateMode : Int
extension TileUpdateMode: CustomStringConvertible, CustomDebugStringConvertible

Overview

Describes how the tilemap updates its tiles in your scene. Changing this property will affect your CPU usage, so use it carefully.

The default mode is TileUpdateMode.dynamic, which updates tiles as needed each frame. For best performance, use TileUpdateMode.actions, which will run SpriteKit actions on animated tiles.

Usage

// passing the tile update mode to the load function
let tilemap = SKTilemap.load(tmxFile: String, updateMode: TileUpdateMode.dynamic)!

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

Properties

Property Description
dynamic Dynamically update tiles as needed.
full All tiles are updated each frame.
actions Tiles are not updated, SpriteKit actions are used instead.
  • ▶︎description

    Declaration

    Swift

    public var description: String { get }
  • Declaration

    Swift

    public var debugDescription: String { get }
  • ▶︎allModes()

    Returns an array of all tile update modes.

    Declaration

    Swift

    public static func allModes() -> [TileUpdateMode]

    Return Value

    [TileUpdateMode] array of all tile update modes.

  • ▶︎next()

    Returns the next tile update mode.

    Declaration

    Swift

    public func next() -> TileUpdateMode

    Return Value

    TileUpdateMode next update mode.