- Home /
Shader Graph: Choosing Texture2DArray Index by uv.z
Hi,
I try to achieve the following: Given a Texture2DArray with different textures I want to draw a specific one. As I've done it without shader graph I set
uv0[index] = new Vector3(uvPosition.x, uvPosition.y, textureArrayIndex);
and use uv.xy as real uv coordinates and uv.z as my index for choosing the Texture out of Texture2DArray. Somehow I do not get it to work with shader graph.
I use this layout:
It somehow does not pick the correct index but uses some other (constant) index. I have a functioning workaround using another uv channel, but I suppose it should work as I've done above, right? Here is my work-around using uv2 only for picking the correct index:
uvs[index] = new Vector2(uvPosition.x, uvPosition.y);
uvs2[index] = new Vector2(textureArrayIndex,0);
With a graph like this:
So, am I doing it wrong or is there a bug?
Answer by Muffty · Jan 08, 2019 at 03:51 PM
The reason was found: Vector 3 and 4 is not yet implemented for UVs in shader graph
Your answer
![](https://koobas.hobune.stream/wayback/20220612185340im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to add sprite or particles on shader 0 Answers
Shader Graph not showing when included in build? 0 Answers
Outline in shader graph 0 Answers
Intersection / Geometry blend shader graph problem 0 Answers
Shader Graph Positioned Vertex Normals 2 Answers