tvOS Compile Error

Hi,

I’m having problems trying to compile the project targeting the tvOS platform.

I think it’s not an issue with my project integrating the package, because opening the the Unity samples for v1.19.0 with Unity 6 targeting tvOS has the same compilation errors:

Library/PackageCache/com.cesium.unity@03780efe4504/Runtime/CesiumPointCloudRenderer.cs(101,17): error CS0103: The name 'XRSettings' does not exist in the current context
Library/PackageCache/com.cesium.unity@03780efe4504/Runtime/CesiumPointCloudRenderer.cs(101,51): error CS0103: The name 'XRSettings' does not exist in the current context
Library/PackageCache/com.cesium.unity@03780efe4504/Runtime/CesiumPointCloudRenderer.cs(102,17): error CS0103: The name 'XRSettings' does not exist in the current context
Library/PackageCache/com.cesium.unity@03780efe4504/Runtime/CesiumPointCloudRenderer.cs(102,51): error CS0103: The name 'XRSettings' does not exist in the current context

I’ve tried removing all XR and VR packages (because we don’t need them) and the problem persists.

I’ve also created a bug in the GitHub page with the same issue.

Reproduction steps

  1. Download Unity samples for v1.19.0

  2. Open the project with Unity 6.0 version, for example 6.0.58f2

  3. Switch platform to target and compile for tvOS

Do I have to configure something special? Or maybe use in the project settings a predefined Define Symbol.

Thanks in advance.

I just found out that if I add in PlayerSetting only for tvOS in the Scripting Define Symbols the define ENABLE_XR the compilation errors disappear, but a new one appear:

Library/PackageCache/com.unity.test-framework@1f954279c37e/UnityEditor.TestRunner/UnityTestProtocol/UtpMessageBuilder.cs(49,47): error CS0117: ‘XRDevice’ does not contain a definition for ‘model’

Ok, one way to fix this is to modify the package to fix this class for tvOS. Basically in the class that is throwing the error CesiumPointCloudRenderer, add a #if_def in the part that is causing the error:

#if ENABLE_XR
            if (XRSettings.stereoRenderingMode == XRSettings.StereoRenderingMode.SinglePassInstanced ||
                XRSettings.stereoRenderingMode == XRSettings.StereoRenderingMode.SinglePassMultiview)
            {
                this._pointMaterial.EnableKeyword("INSTANCING_ON");
            }
#endif

But the problems is that the package needs to be modified. And that’s something we want to avoid.

Any news on this?

Hi @Fengel,

tvOS is not a supported platform, and as far as I know you’re the first person to try it.

I think that even if you get past these XR issues, you’ll also need to build the native code for the tvOS platform. This is usually the much more challenging part of supporting a new platform. To start, you’ll need to follow the Developer Setup instructions. Changes to the plugin will certainly be required. But if you get it working, we’re happy to accept a pull request for it, and then your changes will be included in the next release!

I have the same issue. I’m on Unity 6000.1.17f1 and have a Windows target (no tvOS). There is no UnityEngine.XR namespace available.

In my thinking, the according code misses an #if ENABLE_XR_MODULE check around it.

Hi @myavuzselim, welcome to the community!

Can you please walk us through the steps that lead to the problem you’re seeing? If you believe you have a fix, please open a pull request with it and we’ll take a look!

Hi @Kevin_Ring .

The XR related symbols can’t be accessed unless the Unity package “com.unity.xr.management” is installed in the Unity project. I see that the package is there by default for some template projects (I verified the URP template). But our Unity project does not have that package installed for some reason. It might have been explicitly uninstalled because it is not really needed for us.

When that package is missing, we get the following error for CesiumForUnity package compilation:

Library/PackageCache/com.cesium.unity@03780efe4504/Runtime/CesiumPointCloudRenderer.cs(101,17): error CS0103: The name ‘XRSettings’ does not exist in the current context

It can be fixed by adding ENABLE_XR_MODULE checks around the according code:

#if ENABLE_XR_MODULE
if (XRSettings.stereoRenderingMode == XRSettings.StereoRenderingMode.SinglePassInstanced ||
XRSettings.stereoRenderingMode == XRSettings.StereoRenderingMode.SinglePassMultiview)
{
this._pointMaterial.EnableKeyword(“INSTANCING_ON”);
}
#endif

Created PR: Fixed Cesium build for projects without 'com.unity.xr.management' installed by myss · Pull Request #633 · CesiumGS/cesium-unity · GitHub

Thanks, we also had same issue.

However even after your fix I am not able to compile our project for tvOS platform with error message: The type or namespace name ‘CesiumForUnity’ could not be found. Any idea what can be wrong? Others platforms OK, same for Editor.

It is maybe the lack of support of tvOS, @Kevin_Ring is not by any chance tvOS support on your roadmap? Thx

Hi @jan.bartosek, welcome to the community!

tvOS is not a supported platform, so the native code binaries for that platform are missing. You’ll need to make modifications to the plugin to support that platform, and build it yourself.