TextureArrayBuilder WithDynamicUsage()

book_4_sparkGenerated
code_blocksInput

Description

The WithDynamicUsage method is part of the TextureArrayBuilder class in the Sandbox namespace. This method configures the texture array to be used with dynamic usage, which is suitable for textures that are frequently updated or modified. This setting allows for more efficient updates at the cost of potentially higher memory usage or lower performance in certain scenarios.

Usage

To use the WithDynamicUsage method, you must first create an instance of the TextureArrayBuilder class. Once you have the builder instance, you can chain the WithDynamicUsage method to configure the texture array for dynamic usage. This method returns the same TextureArrayBuilder instance, allowing for method chaining to further configure the texture array.

Example

// Example of using WithDynamicUsage
TextureArrayBuilder builder = new TextureArrayBuilder();
builder.WithDynamicUsage();

// Continue configuring the builder as needed
builder.WithSize(1024, 1024)
       .WithFormat(ImageFormat.RGBA8)
       .WithCount(4);

// Finish building the texture array
Texture textureArray = builder.Finish();