Table of Contents

Method CreateSprite

Namespace
MonoGame.Aseprite
Assembly
MonoGame.Aseprite.dll

CreateSprite(string, int)

Creates a new Sprite from the TextureRegion at the specified index in this TextureAtlas.

public Sprite CreateSprite(string spriteName, int regionIndex)

Parameters

spriteName string

The name to assign the Sprite that is created.

regionIndex int

The index of the TextureRegion element in this TextureAtlas assign the Sprite that is created.

Returns

Sprite

The Sprite that is created by this method.

Exceptions

ArgumentOutOfRangeException

Thrown if the specified index is less than zero or is greater than or equal to the total number of TextureRegion elements in this TextureAtlas.

CreateSprite(int)

Creates a new Sprite from the TextureRegion at the specified index in this TextureAtlas.

public Sprite CreateSprite(int regionIndex)

Parameters

regionIndex int

The index of the TextureRegion element to assign the Sprite that is created.

Returns

Sprite

The Sprite that is created by this method.

Exceptions

ArgumentOutOfRangeException

Thrown if the specified index is less than zero or is greater than or equal to the total number of TextureRegion elements in this TextureAtlas.

CreateSprite(string, string)

Creates a new Sprite from the TextureRegion with the specified name in this TextureAtlas.

public Sprite CreateSprite(string spriteName, string regionName)

Parameters

spriteName string

The name to assign the Sprite that is created.

regionName string

The name of the TextureRegion element in this TextureAtlas assign the Sprite that is created.

Returns

Sprite

The Sprite that is created by this method.

Exceptions

KeyNotFoundException

Thrown if this TextureAtlas does not contain a TextureRegion with the name specified.

CreateSprite(string)

Creates a new Sprite from the TextureRegion with the specified name in this TextureAtlas.

public Sprite CreateSprite(string regionName)

Parameters

regionName string

The name of the TextureRegion element in this TextureAtlas assign the Sprite that is created.

Returns

Sprite

The Sprite that is created by this method.

Exceptions

KeyNotFoundException

Thrown if this TextureAtlas does not contain a TextureRegion with the name specified.