PanelTexture2D
- Last UpdatedFeb 19, 2025
- 3 minute read
The PanelTexture2D node inherits from RectBase2D. It provides the functionalities needed to create a Rect with scrolling content at runtime. Texture scrolling can be achieved by modifying the texturePosition field. The texture on the PanelTexture2D can be scaled by using the textureSize parameter. When scaling the texture, make sure the gridSize field of the attached Texture2D is also modified to the same value as the textureSize field to ensure the interaction works correctly.
Interaction with the elements of attached Texture2D is supported. The field propagateEvent is set to true by default in order to enable interaction with the elements in the Texture2D. PanelTexture2D can also be rendered to another texture by making use of the renderToTexture2D field.
Platform support
This node is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-Portable WASM platforms.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
Full support |
Full support |
Full support |
Full support |
|
|
|
|
|
|
Code example
This is a code example for the PanelTexture2D node, combined with a slider and two buttons to have a scrolling window.
<PanelTexture2D name="finish_pnlTexture" templateInfo="PanelTexture2D|finish_pnlTexture" order="14" parent="finishRevamp_parent" position="370 342" size="1142 420" texture2D="finish_tableTexture" visible="true" />
<!-- navigation -->
<define name="interface.finish.scrollSpeed" value="128" />
<Button2D name="finish_btn_scrollUp" size="40 40" order="14" position="1510 340" parent="finishRevamp_parent" image="btn_up_normal.png" visible="true" />
<route from="finish_btn_scrollUp.buttonDown" to="finish_rng_uv.addValueOverTime" value="[?@finish_btn_scrollUp.buttonDown@,#-1*@def:interface.finish.scrollSpeed@#,0]" />
<Button2D name="finish_btn_scrollDown" size="40 40" order="14" position="1510 724" parent="finishRevamp_parent" image="btn_down_normal.png" visible="true"/>
<route from="finish_btn_scrollDown.buttonDown" to="finish_rng_uv.addValueOverTime" value="[?@finish_btn_scrollDown.buttonDown@,@def:interface.finish.scrollSpeed@,0]" />
<Range name="finish_rng_uv" rangeMin="0" rangeMax="0" mode="linear" />
<route from="finish_rng_uv.currentValue" to="finish_pnlTexture.texturePosition" value="0 @finish_rng_uv.currentValue@" />
<Slider2D name="finish_sld_scroll" direction="vertical" position="1511 380" colorBackground="0.1568 0.1568 0.1568 1" size="37 344" visible="true" parent="finishRevamp_parent" imageSelector="scrollbar_selector.png" value="0" valueScale="1" colorBar="0.1568 0.1568 0.1568 1" borderSize="10 0" order="14"/>
<route from="finish_rng_uv.currentValue" to="finish_sld_scroll.value" condition="@finish_btn_scrollUp.buttonDown@+@finish_btn_scrollDown.buttonDown@" />
<route from="finish_sld_scroll.value" to="finish_rng_uv.currentValue" condition="!@finish_btn_scrollUp.buttonDown@^!@finish_btn_scrollDown.buttonDown@"/>
PanelTexture2D fields
These are the fields for PanelTexture2D node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > RectBase2D > PanelTexture2D
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
texture2D |
sstring |
Optional |
Name of the Texture2D node to render inside the panel. |
|
|
texturePosition |
svec2 |
Mandatory |
0 0 |
Position of the rendered texture within the panel. It can be changed at runtime to create a scrolling effect. |
|
textureSize |
svec2 |
Mandatory |
-1 -1 |
Size of the texture, -1 means actual texture size. |