---
title: SKMutableTexture
framework: spritekit
role: symbol
role_heading: Class
path: spritekit/skmutabletexture
---

# SKMutableTexture

A texture whose contents can be dynamically updated.

## Declaration

```swift
class SKMutableTexture
```

## Mentioned in

Loading and Using Textures

## Overview

Overview Normally, SpriteKit textures (SKTexture objects) are static, meaning that once created, their contents cannot be changed. This is important because a static image can be more efficiently managed inside the graphics hardware. However, sometimes you need to be able to update the contents of a texture dynamically. In this case, you should use a mutable texture. Because there is a performance penalty for updating the texture’s contents, consider other options first. For example, you can render a texture in hardware using the texture(from:) method and a node tree. To use this class, create a mutable texture using either one of its creation methods or those of its superclass. Then, when you need to update the mutable texture object’s contents, call the modifyPixelData(_:) method. Your block is called with the location of the texture in memory. Your block should update this texture and then return.

## Topics

### Creating an Empty Mutable Texture

- [init(size:pixelFormat:)](spritekit/skmutabletexture/init(size:pixelformat:).md)
- [init(size:)](spritekit/skmutabletexture/init(size:).md)

### Modifying a Mutable Texture’s Contents

- [modifyPixelData(_:)](spritekit/skmutabletexture/modifypixeldata(_:).md)

## Relationships

### Inherits From

- [SKTexture](spritekit/sktexture.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

## See Also

### Textures

- [Maximizing Texture Performance](spritekit/maximizing-texture-performance.md)
- [SKTexture](spritekit/sktexture.md)
- [SKTextureAtlas](spritekit/sktextureatlas.md)
