Version: 2022.3
LanguageEnglish
  • C#
Virtual Texturing is experimental and not ready for production use. The feature and documentation might be changed or removed in the future.

Streaming.GetTextureStackSize

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

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

Parameters

mat The Material that contains the Virtual Texture Stack. The Virtual Texture Stacks contained in a Material are declared in the Material's Shader.
stackNameId 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.
width Unity populates width with the width of the Virtual Texture Stack, in pixels.
height Unity populates height with the height of the Virtual Texture Stack, in pixels.

Description

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

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.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961