Table of Contents

Method TryGetSlice

Namespace
MonoGame.Aseprite
Assembly
MonoGame.Aseprite.dll

TryGetSlice(string, out Slice?)

Returns the Slice element with the specified name from this TextureRegion.

public bool TryGetSlice(string name, out Slice? slice)

Parameters

name string

The name of the Slice element to locate.

slice Slice

When this method returns true, contains the Slice located; otherwise, null

Returns

bool

true if the Slice was located; otherwise, false. This method returns false if this TextureRegion does not contain a Slice element with the specified name.

TryGetSlice<T>(string, out T?)

Returns the Slice element with the specified name from this TextureRegion as the type specified.

public bool TryGetSlice<T>(string name, out T? slice) where T : Slice

Parameters

name string

The name of the Slice element to locate.

slice T

When this method returns true, contains the Slice located; otherwise, null

Returns

bool

true if the Slice was located; otherwise, false. This method returns false if this TextureRegion does not contain a Slice element with the specified name.

Type Parameters

T

The type to return the located Slice element as. Must derived from the base type Slice.