Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Addressables build on 2021 LTS results in non-fatal script errors

Discussion in 'Addressables' started by JeffTheCampbell, Apr 28, 2022.

  1. JeffTheCampbell

    JeffTheCampbell

    Joined:
    Jul 11, 2018
    Posts:
    28
    When building Addressables on 2021 LTS we are now seeing several non-fatal Debug.LogError messages printed to the console about attempting to resolve a generic type. There are several of these that occur with similar stack traces, but because they are being executed from the native Unity menu item to build Addressables (from the Addressable Groups UI) only the error message itself is logged to the console.

    Unity Editor: 2021.3.1f1
    Addressables: 1.19.19

    If a developer creates a custom menu item to build addressables the full stack trace can be retrieved for these debuglog errors. At no point is an exception thrown due to these errors.

    Code (CSharp):
    1. [MenuItem("Troubleshoot Addressable Builds")]
    2.         public static void TroubleshootAddressableBuilds()
    3.         {
    4.             // Provides a code-entry point to building Addressables so we can step-through if need be.
    5.             try
    6.             {
    7.                 AddressableAssetSettings.BuildPlayerContent(out var result);
    8.  
    9.                 Debug.Log(JsonConvert.SerializeObject(result));
    10.             }
    11.             catch (Exception e)
    12.             {
    13.                 Debug.LogError(e);
    14.             }
    15.         }

    At first we thought these errors were causing the build to fail, however when we created a test menu item to debug the build and check the BuildResult it ended up still reporting as successful.

    It's not clear to us how we should be attempting to correct these errors or what even is generating them, but so far it does not appear to be failing our addressable builds.
     
    Last edited: Apr 28, 2022
    FamishedMammal likes this.
  2. MylesLambert

    MylesLambert

    Joined:
    Dec 31, 2012
    Posts:
    61
    I've run into the same issue. Out of interest is the field this is referencing serialized at some point using SerializeReference?
     
  3. JeffTheCampbell

    JeffTheCampbell

    Joined:
    Jul 11, 2018
    Posts:
    28
    They are serialized fields, using [SerializeField] rather than [SerializeReference].

    Code (CSharp):
    1.         [SerializeField]
    2.         protected T _value = default(T);
    3.         [SerializeField]
    4.         private bool _readOnly = false;
    5.         [SerializeField]
    6.         private bool _raiseWarning = true;
    7.         [SerializeField]
    8.         protected bool _isClamped = false;
    9.         [SerializeField]
    10.         protected T _minClampedValue = default(T);
    11.         [SerializeField]
    12.         protected T _maxClampedValue = default(T);
     
  4. Karnsteiner

    Karnsteiner

    Joined:
    Mar 24, 2013
    Posts:
    29
    It seems like these errors do cause builds to fail, but only when done through the native Unity Build Settings window. With our CI tool calling BuildPlayer directly the Debug.LogError calls are still made, but are not fatal and a successful build is created and can be run on device. My hypothesis is that the Unity Build Windows and Menu items catch any Debug.LogErrors and report them as fatal errors even if they're not.

    My guess is that this is some sort of code analysis failing to accomplish something and interpreting it as an error, even if it's not a true compilation error.
     
  5. unity_TZhYzw8HlFHjdg

    unity_TZhYzw8HlFHjdg

    Joined:
    Jan 17, 2022
    Posts:
    1
    I got the same issue without using addressables (package is just imported)

    Unity Editor: 2021.3.0f1
     
  6. PaulGerst

    PaulGerst

    Joined:
    Jan 8, 2013
    Posts:
    8
    Same issue here!

    Unity Editor: 2021.3.0f1 LTS
    Addressables: 1.19.19


    Field 'System.Collections.Generic.List`1<T> Squad.Common.Save.LootPoolSave`1:: Picked' from 'XXX\Development\Unity\Squad\Library\ScriptAssemblies\Squad.Common.dll', exception Failed to resolve T
    UnityEditor.AddressableAssets.Settings.AddressableAssetSettings:BuildPlayerContent ()
    Squad.Unity.Editor.SquadEditorBuilder:BuildAddressables () (at Assets/Scripts/Squad.Unity.Editor/Editor/SquadEditorBuilder.cs:55)
    Squad.Unity.Editor.SquadEditorBuilder:FullBuild () (at Assets/Scripts/Squad.Unity.Editor/Editor/SquadEditorBuilder.cs:45)
     
  7. gezapp

    gezapp

    Joined:
    Apr 18, 2014
    Posts:
    20
    Same issue here!

    Unity Editor: 2020.3.35
    Addressables: 1.19.19

    The problems disappear with the old version

    Unity Editor: 2020.3.16
    Addressables: 1.19.19
     
    FamishedMammal likes this.
  8. FamishedMammal

    FamishedMammal

    Joined:
    Nov 3, 2015
    Posts:
    113
    Ahhh, I wonder if this is what has been causing my problems upgrading to Unity 2020
     
  9. FlaSh-G

    FlaSh-G

    Joined:
    Apr 21, 2010
    Posts:
    212
    I'm having the same issue in 2021.3.2f1, no Addressables involved.

    There is a [Serializable] class Foo<T> that references a class Bar<T> that inherits from ScriptableObject.