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

Question Localized timeline, Wait for completion error

Discussion in 'Localization Tools' started by Midonk, Sep 13, 2022.

  1. Midonk

    Midonk

    Joined:
    Oct 8, 2018
    Posts:
    34
    Hello @karl_jones , I am working on a localized timeline audio track. My problem comes here from the "Wait for completion" located on each timeline clips. If they are all checked, there is no problem but the timeline has to load every dialog before playing, this create a lag so I unchecked "Wait for completion" and when my timelines load, there is an infinite loop of error logging in my console saying:

    "Assertion failed: Calling WaitForCompletion on an operation that is already waiting."

    Why do I get this error as the clips aren't supposed to wait for completion ?
    In addition, my stack trace is really weird. It looks like OnEnable is called from LocalizedAsset.AssetChanged.



    That is not supposed to happen right ?

    The logic under this seems a bit intricated, you may consult the "LocalizedAudioClip" script below.
    If you the case requires it, let's make a call, that wouldbe cool
     

    Attached Files:

  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    Yeah, there's something strange going on here. I can't see why OnEnable would be called from
    AssetChanged. Are you able to share the project or an example project which has the problem so I can try and debug it?
     
  3. Midonk

    Midonk

    Joined:
    Oct 8, 2018
    Posts:
    34
    So, I did some experimentation today:
    • First, I created a brand new project with only required script to test if I would be able to give you a way to reproduce the issue but there was no error. All my audio clips load asynchronously as smooth as it can.
    • I built that sample project because the errors I talked about (with WaitForCompletion) happens during build and it was perfectly running, no error, no warning, all good.
    • Then I thought it could be the project, so I made a separated scene in the original project to check if any problem occurs. I reproduced the same scene as the one in the sample project that works. No error when entering play mode but when I changed the locale the async operation failed like, a lot (159 times) for a simple timeline with 4 localized clip in it.
    • In addition, as the audio failed to load in the timeline clips, they were missing in the inspector. Usually this isn't a big deal because the localized clip is designed to load its audio on enable (when entering play mode) and on graph rebuilds (when playing the timeline but not only). But this time, there was still no audio when entering play mode nor playing the timeline, all of this without any error

    upload_2022-9-14_14-7-38.png

    "Asset exists with main Type=UnityEngine.AudioClip, which is not assignable from the requested Type=UnityEngine.AudioClip". AudioClip not assignable to AudioClip ? What o_O

    The timeline don't seems to rebuild itself properly neither when played in the director and all the timeline of my project get enabled at the same time when entering play mode which is, I don't know, weird ? This is getting really bizarre and complex at the same time. Why does the "same" scene in two different project with apparently the same settings, packages, version, everything, produce a result so different ?

    So yeah, I cannot give you a simplified version of the issue because it looks like it should be working.
     
    Last edited: Sep 14, 2022
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    Is this in the Editor or a player build? Do you have a different setting on the Addressable Play Mode for the 2 projects?

    upload_2022-9-14_14-14-5.png
     
  5. Midonk

    Midonk

    Joined:
    Oct 8, 2018
    Posts:
    34
    @karl_jones this happens in editor and both project play mode are set to "Use Existing"
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    Are you able to share your project? I can provide a link to upload it if you like.
     
  7. Midonk

    Midonk

    Joined:
    Oct 8, 2018
    Posts:
    34
    Okay? Let's go for this link of yours. I assume this is a private repo or somethink like this ?
     
  8. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    Ill dm you
     
  9. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,845
    Ok I found the issue. What made this hard to figure out was the Addressables error message was completely wrong and misleading :(

    The problem here is you have some assets that are not marked as addressable, so the system can not find them.
    Later on, when addressables is reporting the issue it does a check when in Editor and converts the key(guid) into the asset path, if the asset exists it assumes that the problem must be a type mismatch and so reports that, it never checks if the asset is actually part of addressables! I'll speak to the team and get this improved.

    For now, there's a simple way to fix this, we have a rule in the Addressable Analyzers that looks for this issue.
    https://docs.unity3d.com/Packages/c...anual/Addressables.html#addressable-analyzers

    upload_2022-9-16_13-58-20.png

    Run the rule and then click Fix Selected rule. Everything should work now.
     
    Midonk likes this.
  10. Midonk

    Midonk

    Joined:
    Oct 8, 2018
    Posts:
    34
    Waw, that was unexpected ! Thank you very much, everything works now
     
    karl_jones likes this.