float GetFloat( Sandbox.StringToken& name, System.Single& defaultValue )

book_4_sparkGenerated
code_blocksInput

Description

The GetFloat method retrieves a floating-point value associated with a specified StringToken from the RenderAttributes collection. If the specified token does not exist, the method returns a default value provided by the caller.

Usage

To use the GetFloat method, you need to have an instance of RenderAttributes. Call the method with a StringToken that identifies the attribute you want to retrieve and a default value that will be returned if the attribute is not found.

Example

RenderAttributes renderAttributes = new RenderAttributes();
StringToken token = new StringToken("exampleToken");
float defaultValue = 1.0f;

float result = renderAttributes.GetFloat(ref token, ref defaultValue);
// result will be the value associated with 'exampleToken' or 1.0f if not found.