hi i’m trying to write some kind of screen effect but requires a compute buffer which size equals to screen.
on the desktop i use Screen.Width*Screen.Height to get it, and the effect is work fine,
but that has error on VR due to wrong buffer size, that the value get from Screen seems like still the desktop screen while i’m streaming VR .
i did try to use VRSettings.eyeTextureWidth according to this: Unity - Scripting API: Screen.currentResolution
but the value i got always be zero while i’m using streaming.
What kind of streaming are you doing? What XR plugin are you using? Quest link?
OpenXR + SteamVR
Sorry for my late reply.
It may be because you’re trying to access the eye texture size on startup - XR takes a few frames to start and we won’t know eye texture size until the textures are actually created. You can do something like this to get them as early as possible:
void Start()
{
StartCoroutine(WidthHeight());
}
IEnumerator WidthHeight()
{
while (XRSettings.eyeTextureWidth == 0)
yield return new WaitForEndOfFrame();
Debug.Log($"w: {XRSettings.eyeTextureWidth} h: {XRSettings.eyeTextureHeight}");
}