Hi @Cotta
I have the same problem : unit_StereoEyeIndex is always 0 when I publish to the device,but effective on Unity Editor。
Below is my environment:
Unity 2018.4.25
Wave SDK 3.1.94
Focus Plus
This is my shader:
Shader "Unlit/TestSinglepass"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex;
float4 _MainTex_ST;
v2f vert (appdata v)
{
v2f o;
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
fixed4 col = fixed4(0, 0, 0, 1);
if (unity_StereoEyeIndex == 0)
{
col = fixed4(1, 0, 0, 1); // Left:red
}
else
{
col = fixed4(0, 1, 0, 1); // Right:green
}
return col;
}
ENDCG
}
}
}
Thanks for help. @Tony PH Lin @Corvus