Texture GetTexture( Sandbox.StringToken& name, Sandbox.Texture& defaultValue )
Texture GetTexture( System.String& name, Sandbox.Texture& defaultValue )

book_4_sparkGenerated
code_blocksInput

Description

The GetTexture method of the RenderAttributes class retrieves a texture associated with a given name. If the texture is not found, it returns a specified default texture.

Usage

To use the GetTexture method, you need to provide a StringToken that represents the name of the texture you want to retrieve, and a Texture that serves as the default value if the texture is not found.

This method is useful when you want to ensure that a texture is always available, either by retrieving an existing one or falling back to a default.

Example

RenderAttributes renderAttributes = new RenderAttributes();
StringToken textureName = new StringToken("exampleTexture");
Texture defaultTexture = new Texture();

Texture retrievedTexture = renderAttributes.GetTexture(ref textureName, ref defaultTexture);

// Use the retrievedTexture in your rendering logic