Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

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

Discussion in 'AR' started by yoh-mizutani, May 12, 2020.

  1. yoh-mizutani

    yoh-mizutani

    Joined:
    Sep 5, 2018
    Posts:
    4
    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 :

    Code (CSharp):
    1.  
    2. public void OnProcessShader(Shader shader, ShaderSnippetData snippet, IList<ShaderCompilerData> data)
    3.          {
    4.                 // Remove shader variants for the camera background shader that will fail compilation because of package dependencies.
    5.                 string backgroundShaderName = ARKitCameraSubsystem.backgroundShaderName;
    6.                 if (backgroundShaderName.Equals(shader.name))
    7.                 {
    8.                     foreach (var backgroundShaderKeywordToNotCompile in ARKitCameraSubsystem.backgroundShaderKeywordsToNotCompile)
    9.                     {
    10.                         ShaderKeyword shaderKeywordToNotCompile = new ShaderKeyword(shader, backgroundShaderKeywordToNotCompile);
    11.  
    12.                         for (int i = (data.Count - 1); i >= 0; --i)
    13.                         {
    14.                             if (data[i].shaderKeywordSet.IsEnabled(shaderKeywordToNotCompile))
    15.                             {
    16.                                 data.RemoveAt(i);
    17.                             }
    18.                         }
    19.                     }
    20.                 }
    21.             }
    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.
     
    Jelmer123 likes this.
  2. Jelmer123

    Jelmer123

    Joined:
    Feb 11, 2019
    Posts:
    104
    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 :()
     
    Last edited: May 13, 2020
  3. yoh-mizutani

    yoh-mizutani

    Joined:
    Sep 5, 2018
    Posts:
    4
    No, I have not yet.
     
  4. armanayraHOU

    armanayraHOU

    Joined:
    Mar 11, 2020
    Posts:
    3
    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:
    Code (CSharp):
    1. ShaderKeyword shaderKeywordToNotCompile = new ShaderKeyword(backgroundShaderKeywordToNotCompile);
     
  5. yoh-mizutani

    yoh-mizutani

    Joined:
    Sep 5, 2018
    Posts:
    4
    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.
     
  6. LucasRizzotto

    LucasRizzotto

    Joined:
    Dec 11, 2015
    Posts:
    12
    Having this as well
     
  7. Deankovitch

    Deankovitch

    Joined:
    Sep 28, 2012
    Posts:
    23
    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
     
  8. Simuloid-Visualization

    Simuloid-Visualization

    Joined:
    Dec 23, 2013
    Posts:
    104
    Anyone found a solution to this? Using Unity2019.2.17f1
     
  9. Deankovitch

    Deankovitch

    Joined:
    Sep 28, 2012
    Posts:
    23
    If you're using the AR Foundation try to downgrade the AR Kit package version to 3.0.4.
     
unityunity