Search Unity

BehaviourCallbacks issue

Discussion in 'Addressables' started by PedragDanilovic, Oct 14, 2019.

  1. PedragDanilovic

    PedragDanilovic

    Joined:
    Jun 4, 2019
    Posts:
    9
    Hi,

    We were using addressables for our current project but we don't know if we are missing something. When we use a behaviour at animator, returns null:

    _animator.GetBehaviour<BehaviourCallbacks>(); //returns null

    If the object isn't addressable, works perfectly but, when we use that object as addressable, fails.

    Is it a bug or are we doing something wrong?

    Regards.
     
  2. jpiera

    jpiera

    Joined:
    Jun 10, 2019
    Posts:
    6
    Hi,

    I have found another related error with addressable system. I have tried to load an Audio Mixer from addressables.
    I have tried it with AssetReference and directly with the path.It doesn´t work well, the system return me always a null object( only in release version in all platforms, in editor works fine).I write the code here:


    Code (CSharp):
    1.  IEnumerator LoadMixer()
    2.         {
    3.             AsyncOperationHandle<UnityEngine.AddressableAssets.ResourceLocators.IResourceLocator> asyncO = Addressables.InitializeAsync();
    4.             yield return asyncO;
    5.             AsyncOperationHandle<UnityEngine.Audio.AudioMixer> asyncOp = Addressables.LoadAssetAsync<UnityEngine.Audio.AudioMixer>(audioMixerPath);
    6.             yield return asyncOp;
    7.             UpdateMixer(asyncOp.Result as UnityEngine.Audio.AudioMixer);
    8.  
    9.         }
     
  3. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    988
    someone else had this issue, but the forum thread dried up before I could get info: https://forum.unity.com/threads/statemachinebehaviour-returning-null-in-1-1-7.722816/

    So if you have a repro, definitely file a bug against unity and put the case number here.

    I don't believe this is related. Is this broken as of the latest (1.2.4)? We used to have an issue where AudioMixers were getting stripped from the build due to them appearing to be an editor type. This is fixed in the latest, so please make sure you are on latest and let me know.
     
  4. jpiera

    jpiera

    Joined:
    Jun 10, 2019
    Posts:
    6
    Hello Bill, we are in the lastest addresables version (1.2.4).So, this error persist yet.
    Also we have noticed that _animator.GetBehaviour<BehaviourCallbacks>() return a good value if we wait some time(PedragDanilovic Problem).It is like a time dependence problem.The game object is active when we call to this method but if the object is recently created then the behaviour isn´t avaible.

    Cheers.
     
  5. jpiera

    jpiera

    Joined:
    Jun 10, 2019
    Posts:
    6
    We are using the Unity Version 2019.1.5.f1.
     
  6. DavidUnity3d

    DavidUnity3d

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    295
    Hey @jpiera as it so happens we just fixed an issue with AudioMixers getting loaded from Addressables. With what's given it's hard for me to confidently say if our fix will resolve your AudioMixer problem or not.

    In regards to your animator problem if you wouldn't mind filing a bug report and providing a project we can use to reproduce it that would be a massive help. Thank you!
     
  7. JVLVince

    JVLVince

    Joined:
    Jul 20, 2016
    Posts:
    26
    Hello Bill. Currently I have the same issue as @jpiera . I think that this issue wasn't completely fixed. I have tested with 2 case:

    case 1:
    Code (CSharp):
    1. [SerializeField]
    2. private AssetReference _audioMixerRef;
    3.  
    4. public void TestLoadAudioMixer() {
    5.             _audioMixerRef.LoadAssetAsync<AudioMixer>().Completed += handle => {
    6. /// Some Stuff
    7.             };
    8.         }
    9.  
    And on editor, the audioMixerRef was set like this:


    => Then everything work well

    case 2:
    With the same code above.
    And on editor, the audioMixerRef was set like this:


    => This errors come:
    Exception encountered in operation UnityEngine.AddressableAssets.Initialization.InitializationOperation, result='', status='Succeeded' - Chain<AudioMixer>: ChainOperation of Type: UnityEngine.Audio.AudioMixer failed because dependent operation failed
    Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=394d22817bfd1436eabdd3c998c72a6f[Master]
    UnityEngine.ResourceManagement.ChainOperationTypelessDepedency`1:OnWrappedCompleted(AsyncOperationHandle`1)
    DelegateList`1:Invoke(AsyncOperationHandle`1) (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/ResourceManager/Util/DelegateList.cs:69)
    UnityEngine.ResourceManagement.ResourceManager:Update(Single)
    MonoBehaviourCallbackHooks:Update() (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/ResourceManager/Util/MonoBehaviourCallbackHooks.cs:19)

    and This:

    Exception encountered in operation UnityEngine.ResourceManagement.ResourceManager+CompletedOperation`1[UnityEngine.Audio.AudioMixer], result='', status='Failed': Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=394d22817bfd1436eabdd3c998c72a6f[Master]
    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1:<.ctor>b__27_0(AsyncOperationHandle)
    DelegateList`1:Invoke(AsyncOperationHandle) (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/ResourceManager/Util/DelegateList.cs:69)
    UnityEngine.AddressableAssets.Initialization.<>c__DisplayClass13_0:<LoadContentCatalogInternal>b__0(AsyncOperationHandle`1)
    DelegateList`1:Invoke(AsyncOperationHandle`1) (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/ResourceManager/Util/DelegateList.cs:69)
    UnityEngine.ResourceManagement.ChainOperation`2:OnWrappedCompleted(AsyncOperationHandle`1)
    DelegateList`1:Invoke(AsyncOperationHandle`1) (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/ResourceManager/Util/DelegateList.cs:69)
    UnityEngine.ResourceManagement.ResourceManager:Update(Single)
    MonoBehaviourCallbackHooks:Update() (at Library/PackageCache/com.unity.addressables@1.5.0/Runtime/ResourceManager/Util/MonoBehaviourCallbackHooks.cs:19)
    The same thing happen with the Addressables.LoadAssetAsync() API.
    Code (CSharp):
    1. Addressables.LoadAssetAsync<AudioMixer>("MyAssetAddress[MixerGroup]")
    => error
    Code (CSharp):
    1. Addressables.LoadAssetAsync<AudioMixer>("MyAssetAddress")
    => worked

    Hope this can have you fix this bug.
    Atm, We don't know the load subObject of AudioMixer ("MyAssetAddress[MixerGroup]") is by design of addressable (just like SpriteAtlasRef) or it just a editorDrawer bug so if you can please let us know.

    Thanks.
     
  8. JVLVince

    JVLVince

    Joined:
    Jul 20, 2016
    Posts:
    26
    This is my environment:
    + Unity 2019.2.15f1
    + Addressable Pack: 1.5.0 (Newest atm)
     
  9. DavidUnity3d

    DavidUnity3d

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    295
    Ah, I see what you mean. I think this might be more an issue with loading an objects sub-assets rather than being specifically about AudioMixerGroups (though I could be wrong). I'll get a ticket made for us to look at this.
     
    JVLVince likes this.
  10. JVLVince

    JVLVince

    Joined:
    Jul 20, 2016
    Posts:
    26
    Thanks David!!
     
    DavidUnity3d likes this.
unityunity