Search Unity

"in" keyword not recognized by API updater

Discussion in 'Editor & General Support' started by jeremies_unity, Jun 11, 2019.

  1. jeremies_unity

    jeremies_unity

    Joined:
    Oct 16, 2018
    Posts:
    26
    We use the `in` keyword a lot in our codebase, but as soon as the auto-updater sees it, it stops and says so in an error.
     
    Last edited: Jun 11, 2019
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please provide the code in question, and the error that you are receiving.
     
  3. jeremies_unity

    jeremies_unity

    Joined:
    Oct 16, 2018
    Posts:
    26
    This is the truncated error:

    Code (CSharp):
    1. APIUpdater encountered some issues and was not able to finish.
    2.  
    3.     [Script Updater] Assets\Scripts\Systems\Server\EffectControllerServerSystem.cs(49,71): error CS1525: Invalid expression term 'in'
    4.     [Script Updater] Assets\Scripts\Systems\Client\PlayerPhysicsSystem.cs(48,76): error CS1525: Invalid expression term 'in'
    5.     [Script Updater] Assets\Scripts\Data\EffectParamData.cs(35,36): error CS1041: Identifier expected; 'in' is a keyword
    6.     [Script Updater] Assets\Scripts\Effects\EffectEnergy.cs(67,61): error CS1041: Identifier expected; 'in' is a keyword
    7.     [Script Updater] Assets\Scripts\Systems\Client\PlayerInputSystem.cs(52,78): error CS1041: Identifier expected; 'in' is a keyword
    8.     [Script Updater] Assets\Scripts\Utility\EffectUtility.cs(39,145): error CS1031: Type expected
    9.  
    Example call for EffectControllerServerSystem.cs:

    var shouldRemove = ShouldRemoveEntry(globalTime, in entry, effectData, in combat);

    Definition for that code:

    protected static bool ShouldRemoveEntry(float globalTime, in LastingEffectEntry entry, EffectData effectData, in Combat.Component combat)

    The last error in this log (Type expected in EffectUtility.cs) is also caused by using `in Vector3 position`.
     
  4. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    Which version of Unity are you using?

    This should be supported (we do have tests and I can see that the change that enabled it landed around August/2018).

    Adriano
     
  5. jeremies_unity

    jeremies_unity

    Joined:
    Oct 16, 2018
    Posts:
    26
    Unity 2019.1.6f1

    Scripting backend Mono .Net 4.x
     
  6. AdrianoVerona_Unity

    AdrianoVerona_Unity

    Unity Technologies

    Joined:
    Apr 11, 2013
    Posts:
    317
    That makes sense. In that version the updater only supports C# 7.1 (which does not include in keyword).

    Anyway, even though ScriptUpdater log such errors it should be able to apply updates with no problems.

    Are you getting any problems?

    BTW, just verified that in version 2019.2 we do support C# 7.2 in the updater and you should not get these errors.

    Adriano
     
  7. jeremies_unity

    jeremies_unity

    Joined:
    Oct 16, 2018
    Posts:
    26
    I think it did the job, I just assumed it couldn't based on the errors.

    Thanks :)
     
    AdrianoVerona_Unity likes this.