Search Unity

Question Why error occur at window Standalone build? (Steam)

Discussion in 'Addressables' started by leegod, Dec 1, 2022.

  1. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,476
    So I made game at unity and at Editor, there is no problem to run.
    I am using addressable asset system.

    But recently I am preparing Steam build, so made PC windows standalone build, but then this error occurs and game crash as soon as startup.

    --------
    ArgumentNullException: Value cannot be null.
    Parameter name: source
    at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00000] in <00000000000000000000000000000000>:0
    at BundleManager.DesignItemBundleCompleted (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1[TObject] result, System.String name) [0x00008] in N:\GOD-versionSTEAM\Assets\Prefabs\UIPrefab\YongJin\Bundle\BundleManager.cs:1424
    at BundleManager+<>c__DisplayClass82_0.<Public_BundleCo>b__1 () [0x000c3] in N:\GOD-versionSTEAM\Assets\Prefabs\UIPrefab\YongJin\Bundle\BundleManager.cs:344
    at UnityEngine.WaitUntil.get_keepWaiting () [0x00000] in <00000000000000000000000000000000>:0
    at UnityEngine.CustomYieldInstruction.MoveNext () [0x00000] in <00000000000000000000000000000000>:0
    at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0
    -----------

    code is

    Code (CSharp):
    1.  bool DesignItemBundleCompleted(AsyncOperationHandle<IList<ScriptableObject>> result, string name)
    2.     {
    3.         var List = result.Result.ToList();   <---- 1424 line, error occurs.
    4.         if (List != null)
    5.         {
    6.             for (int i = 0; i < List.Count; i++)
    7.             {
    8.                 Storage.Instance.AddDesignPlan(List[i]);
    9.             }
    10.         }
    11.         return true;
    12.     }
    This is basically for make item bank list after load asset bundle.

    Why error occurs at standalone build and how to resolve?
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,934
    result.Result
    is null, as per the error. Are you ensuring you're waiting until the handled has been completed? Made sure to build your addressables groups before building your standalone build?
     
  3. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,476
    yes, yes.

    Code (CSharp):
    1.  var battleCardHandler = Addressables.LoadAssetsAsync<ScriptableObject>("BattleCard", null);
    2.             var weaponHandler = Addressables.LoadAssetsAsync<ScriptableObject>("Weapon", null);
    3.  
    4.             yield return new WaitUntil(() =>
    5.                                         battleCardHandler.IsDone && weaponHandler.IsDone && armorHandler.IsDone &&
    6.                                         accessoryHandler.IsDone && materialHandler.IsDone && consumeHandler.IsDone &&
    7.                                         sealEffectHandler.IsDone && sealConditionHandler.IsDone && monsterRewardHandler.IsDone &&
    8.                                         monsterSOHandler.IsDone &&
    9.                                         iconHandler.IsDone && soundHandler.IsDone && messageBoxHandler.IsDone);
    10.  
    11.             yield return new WaitUntil(() =>
    12.                                         BattleCardBundleCompleted(battleCardHandler) &&
    13.                                         DesignItemBundleCompleted(weaponHandler, "weapon") &&  <-erorr start
    14.                                         DesignItemBundleCompleted(armorHandler, "Armor") &&
    15.                                         DesignItemBundleCompleted(accessoryHandler, "Accessory") &&
     
  4. LuGus-Jan

    LuGus-Jan

    Joined:
    Oct 3, 2016
    Posts:
    179
    Note, the
    IsDone
    property indicates that the handle has done loading, but doesn't tell that it was successful. You should check the status value as well before accessing the result:
    loadingHandle.IsDone && (loadingHandle.Status == AsyncOperationStatus.Succeeded)
    .

    Perhaps something went wrong loading the contents. It doesn't show you an earlier error? Can you check that you haven't suppressed the logging of errors and exceptions in the addressable asset settings ('Log Runtime Exceptions' is not ticked)?
     
  5. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,476
    Thx for reply. Yes 'Log Runtime Exceptions' is not ticked. So I changed it to tick.
    Here is error log and script.

    bundle-error2.JPG

    bundle-error3.JPG

    Player.log says
    at 7th loading,
    [Result status is Failed name is Seal Condition]
    So why this happen at 7th loading? At what cases this process can be failed? I don't know why especially no problem at all at Unity Editor playing.
    This occurs only Steam PC(windows10) standalone build.

    This process should be succeeded, so I can't let this failed.
     
  6. LuGus-Jan

    LuGus-Jan

    Joined:
    Oct 3, 2016
    Posts:
    179
    Well, I don't know why it errors out since there's no error visible from Addressables itself, just the null ref exception caused in your code. Could be that one of the bundles has corrupted data, or doesn't pass the CRC check (do you have this enabled? It can be disabled if that is actually a problem - it was multiple times in my case).

    Have you tried to run it in editor on a Windows machine using the 'Use Existing Build' play option? That should have the exact same path of execution as in a player build.
     
  7. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,476
    I didn't checked CRC. So these CRC should be all true?

    crc-addressable.JPG
     
  8. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,476
    and so if I use [use existing build] at play mode script, in unity editor too at 7th place
    [Result status is Failed name is Seal Condition], same error occurs.

    ArgumentNullException: Value cannot be null.
    Parameter name: source
     
  9. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,476
    some of my scriptable object name has "#", is this the reason? addressable name can't have "#"?
     
  10. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,476
    so was problem "#" included in scriptable object's name. Changed it to "-" and resolved.