ARFoundation 3.1.3 (ARKit XR Plugin) with Unity2019.2.21 cannot build for iOS

Hi,

When I set up the package manager as below, an error occurred in my AR project for the iOS platform.

  • “com.unity.xr.arfoundation”: “3.1.3”,
  • “com.unity.xr.arkit”: “3.1.3”,
  • “com.unity.xr.arsubsystems”: “3.1.3”,
  • “com.unity.xr.management”: “3.0.3”,

Library/PackageCache/com.unity.xr.arkit@3.1.3/Editor/ARKitBuildProcessor.cs(108,71): error CS1729: ‘ShaderKeyword’ does not contain a constructor that takes 2 arguments

I cannot build my project because this error is displayed.

This error indicates that the constructor of ShaderKeyword does not take two arguments.
From what I’ve been able to find out, it seems that in Unity2019.2 the constructor for ShaderKeyword is a single argument, and Unity2019.3 takes one or two arguments.
So I think the ARKitBuildProcessor.cs in the XR ARKit Plugin (ver.3.1.3) should use a single argument to the constructor of the ShaderKeyword when it is used in Unity2019.2.

The relevant parts of the Unity manual are as follows:

Here is the source code for ARKitBuildProcessor.cs in Unity2019.2 as displayed from the Unity error :

public void OnProcessShader(Shader shader, ShaderSnippetData snippet, IList<ShaderCompilerData> data)
         {
                // Remove shader variants for the camera background shader that will fail compilation because of package dependencies.
                string backgroundShaderName = ARKitCameraSubsystem.backgroundShaderName;
                if (backgroundShaderName.Equals(shader.name))
                {
                    foreach (var backgroundShaderKeywordToNotCompile in ARKitCameraSubsystem.backgroundShaderKeywordsToNotCompile)
                    {
                        ShaderKeyword shaderKeywordToNotCompile = new ShaderKeyword(shader, backgroundShaderKeywordToNotCompile);

                        for (int i = (data.Count - 1); i >= 0; --i)
                        {
                            if (data[i].shaderKeywordSet.IsEnabled(shaderKeywordToNotCompile))
                            {
                                data.RemoveAt(i);
                            }
                        }
                    }
                }
            }

Is this something that can be resolved with some kind of configuration?
It has not occurred with AR Foundation ver. preview-8 3.1.0.

1 Like

Have you found a solution? I have the same problem, in Unity 2019.2.
Edit: I went back to 2.0.2. (no linear color space support :()

No, I have not yet.

I ran into the same issue today.
I removed the first variable, the ‘shader’ and just left the second one and was able to get it to compile

So just:

ShaderKeyword shaderKeywordToNotCompile = new ShaderKeyword(backgroundShaderKeywordToNotCompile);

It does not work for me.
This error was disappeared but I cannot build it (another shader error has occurred).
And when I re-open this project, the same issue has appeared again.

This source file is placed under the Library folder. These files (under the Library) is re-created by the unity editor when I re-open the project.

Having this as well

Hello there.
For those who are facing this issue. A temporary turnaround is to downgrade the com.unity.xr.arkit package to version 3.0.4

Anyone found a solution to this? Using Unity2019.2.17f1

If you’re using the AR Foundation try to downgrade the AR Kit package version to 3.0.4.

I did this and then got a bunch of errors about ARHumanBodyManager. I tried downgrading other packages but it always seems to lead to a bunch of errors.