I have followed the setup instructions for enabling WebCamTexture support in PolySpatial, but I noticed that the Vision Pro does not prompt for camera access permissions.
Can anyone confirm if PolySpatial 1.3.9 explicitly supports Persona via WebCamTexture? Any insights or experiences would be greatly appreciated!
Yes, it should, assuming you set POLYSPATIAL_ENABLE_WEBCAM and the “Camera Usage Description” field (which is what actually causes the prompt for permissions, AFAIK). It may be dependent on your Unity version, however, since we fixed something in the core code at one point that was blocking webcam support. According to the changelog, that was fixed in 2022.3.41f1, though it may have regressed since.
Is this on a device, as opposed to the visionOS simulator? The simulator doesn’t support the Persona feed. What do you mean by a null texture? Is it simply black (as it will be if the user declines to grant camera permissions), or are you getting a null reference error?
Either way, feel free to submit a bug report (and let us know the incident number: IN-#####) so that we can look into it.
Hello Kapolka, I created a minimal runnable program with version Unity 6000.0.32f1 and polyspatial 2.1.2. When running on the device, the RawImage appears purple, and the Persona permissions did not pop up, so Persona cannot be displayed correctly… TestPersona.zip (851.1 KB)
It looks like the part you’re missing is requesting the permissions and waiting until they’re available. You can do that with the RequestUserAuthorization API. I changed the Start method in your SetWebCamDirty class to look like this (importing System.Collections):
private IEnumerator Start()
{
yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
if (Application.HasUserAuthorization(UserAuthorization.WebCam))
{
texture = new WebCamTexture();
texture.Play();
}
}
And I got the expected result. It’s also worth noting that you’ll have to adjust the orientation and aspect ratio of the surface you use to display the texture. This is the code our internal example uses for that (on a square quad):
// Match aspect ratio and flip vertically if appropriate.
var baseScaleY = Mathf.Abs(plane.transform.localScale.y);
plane.transform.localScale = new Vector3(
baseScaleY * webCamTexture.width / webCamTexture.height,
baseScaleY * (webCamTexture.videoVerticallyMirrored ? -1.0f : 1.0f),
plane.transform.localScale.z);
Thank you very much for your response; it solved this tricky problem! After modifying the program code, I was able to successfully access and display the WebCam. However, I encountered a new issue when upgrading the Unity version, and I hope to get your help. Here is the link. issue