# GetTextureStackSize(Material, int, out int, out int)

> Gets the width and height of a Virtual Texture Stack, in pixels.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Rendering.VirtualTexturing](/engine/6000.5/script-reference/unityengine/rendering/virtualtexturing.md)
* **Assembly:** UnityEngine.VirtualTexturingModule

## GetTextureStackSize(Material, int, int, int)

```csharp
public static void GetTextureStackSize(Material mat, int stackNameId, out int width, out int height)
```

### Parameters

**** (\[Material]\(/engine/6000.5/script-reference/unityengine/material)): The Material that contains the Virtual Texture Stack. The Virtual Texture Stacks contained in a Material are declared in the Material's Shader.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The unique identifier for the name of the Virtual Texture Stack, as declared in the Shader. To find the identifier for a given Shader property name, use [Shader.PropertyToID](/engine/6000.5/script-reference/unityengine/shader/propertytoid.md).**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Unity populates `width` with the width of the Virtual Texture Stack, in pixels.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Unity populates `height` with the height of the Virtual Texture Stack, in pixels.

### Remarks

The width and height of a Virtual Texture Stack are usually based on the width and height of the Textures assigned to the Material; however, various factors can cause the width and height of a Virtual Texture Stack to differ from the width and height of its Textures. Use this method to get the current width and height of a Virtual Texture Stack, in pixels.

Use this function to perform logic based on the width and height of the Virtual Texture Stack, such as calculating a mip level.

The width and height of a Virtual Texture Stack are constant for a given set of Textures. If you change the Textures assigned to the Material, the width and height of the Virtual Texture Stack might change.

If you pass invalid data to this method, such as a null Material or an invalid identifier, Unity will throw an exception and the values of `width` and `height` will remain unmodified.
