Localized timeline, Wait for completion error

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

8435747–1117409–LocalizedAudioClip.cs (2.94 KB)

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?

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

8439191--1118243--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 :eyes:

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.

Is this in the Editor or a player build? Do you have a different setting on the Addressable Play Mode for the 2 projects?

8439287--1118267--upload_2022-9-14_14-14-5.png

@karl_jones this happens in editor and both project play mode are set to “Use Existing”

Are you able to share your project? I can provide a link to upload it if you like.

Okay? Let’s go for this link of yours. I assume this is a private repo or somethink like this ?

Ill dm you

Ok I found the issue. What made this hard to figure out was the Addressables error message was completely wrong and misleading :frowning:

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/com.unity.localization@1.3/manual/Addressables.html#addressable-analyzers

Run the rule and then click Fix Selected rule. Everything should work now.

1 Like

Waw, that was unexpected ! Thank you very much, everything works now

1 Like