Update:
I removed the error by just using:
using Wave.OpenXR;
instead of
using Wave.OpenXR.Foveation;
HOWEVER: It doesn't seem to matter what setting I use, I can't detect any foveated rendering actually happening in the build.
I have checked that the code is running using a log statement.
Anyone know how to get it working?
My current full script implementation:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using Wave.OpenXR.Foveation;
#if VIVE
using Wave.OpenXR;
#endif
public class ViveXR_Functions : MonoBehaviour
{
#if VIVE
//from documentation https://developer.vive.com/resources/openxr/openxr-mobile/tutorials/unity/using-foveation-in-your-app/
[SerializeField] XrFoveationModeHTC UsingMode;
void Start()
{
XrFoveationConfigurationHTC[] Configs = new XrFoveationConfigurationHTC[2];
/////////////////////Setting for left eye/////////////////////////////
Configs[0].level = XrFoveationLevelHTC.XR_FOVEATION_LEVEL_HIGH_HTC; //
Configs[0].clearFovDegree = 0; //
Configs[0].focalCenterOffset.x = 0.0f; //
Configs[0].focalCenterOffset.y = 0.0f; //
//////////////////////////////////////////////////////////////////////
////////////////////Setting for right eye/////////////////////////////
Configs[1].level = XrFoveationLevelHTC.XR_FOVEATION_LEVEL_HIGH_HTC; //
Configs[1].clearFovDegree = 0; //
Configs[1].focalCenterOffset.x = 0.0f; //
Configs[1].focalCenterOffset.y = 0.0f; //
//////////////////////////////////////////////////////////////////////
switch (UsingMode)
{
//XR_FOVEATION_MODE_FIXED_HTC: The position of foveation is fixed
case XrFoveationModeHTC.XR_FOVEATION_MODE_FIXED_HTC:
ViveFoveation.ApplyFoveationHTC(XrFoveationModeHTC.XR_FOVEATION_MODE_FIXED_HTC, 0, null);
break;
//XR_FOVEATION_MODE_DYNAMIC_HTC: the position of foveation can be addjust
case XrFoveationModeHTC.XR_FOVEATION_MODE_DYNAMIC_HTC:
ViveFoveation.ApplyFoveationHTC(XrFoveationModeHTC.XR_FOVEATION_MODE_DYNAMIC_HTC, 0, null);
break;
//XR_FOVEATION_MODE_CUSTOM_HTC: the foveation will use the custom setting
case XrFoveationModeHTC.XR_FOVEATION_MODE_CUSTOM_HTC:
ViveFoveation.ApplyFoveationHTC(UsingMode, 2, Configs);
break;
case XrFoveationModeHTC.XR_FOVEATION_MODE_MAX_ENUM_HTC:
ViveFoveation.ApplyFoveationHTC(XrFoveationModeHTC.XR_FOVEATION_MODE_MAX_ENUM_HTC, 0, null);
break;
default:
Debug.Log("VIVE foveation NOT set");
break;
}
}
#endif
}