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

Crash When LoadAssetAsync And Instantiate

Discussion in 'Addressables' started by GodwinTsai, Nov 7, 2019.

  1. GodwinTsai

    GodwinTsai

    Joined:
    Nov 20, 2018
    Posts:
    1
    Version:
    Unity 2018.4.8
    Addressable 1.3.3

    Code (CSharp):
    1. Addressables.LoadAssetAsync<GameObject>("A Prefab").Completed += handle =>
    2.         {
    3.             GameObject.Instantiate(handle.Result);
    4.         };
    5.            
    6.         Addressables.LoadSceneAsync("A Scene", LoadSceneMode.Additive);
    Description:
    1,"A Scene" & "A Prefab" are both added to Addressable.
    2,"A Prefab" was embed in "A Scene" .

    Unity is going to crash when executing GameObject.Instantiate(handle.Result);

    But it work well when using Addressables.Instantiate.

    Hope for help, many thanks.


    The crash log :
    ========== OUTPUTTING STACK TRACE ==================

    0x00000001401AA3A4 (Unity) Transform::GetTransformAccess
    0x00000001406FBD86 (Unity) CollectAndProduceGameObjectHierarchy
    0x00000001406FB994 (Unity) CollectAndProduceClonedIsland
    0x00000001406FB07B (Unity) CloneObjectImpl
    0x00000001406FABCB (Unity) CloneObject
    0x0000000141867607 (Unity) Object_CUSTOM_Internal_CloneSingle
    0x000000004689C5EE (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Object:Internal_CloneSingle (UnityEngine.Object)
    0x000000004689C223 (Mono JIT Code) [C:\buildslave\unity\build\Runtime\Export\UnityEngineObject.bindings.cs:275] UnityEngine.Object:Instantiate<T_REF> (T_REF)
    0x000000005E8B5C23 (Mono JIT Code) [D:\emp_2\EMP\Assets\Common\3rd\CustomSROptions\SROptions.TestPreload.cs:92] SROptions/<>c:<TestLoadScene>b__31_0 (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<UnityEngine.GameObject>)
    0x000000005E5BF657 (Mono JIT Code) [D:\emp_2\EMP\Assets\Common\Extension\com.unity.addressables@1.3.3\Runtime\ResourceManager\Util\DelegateList.cs:69] DelegateList`1<UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<UnityEngine.GameObject>>:Invoke (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1<UnityEngine.GameObject>)
    0x00000000469D987D (Mono JIT Code) [D:\emp_2\EMP\Assets\Common\Extension\com.unity.addressables@1.3.3\Runtime\ResourceManager\AsyncOperations\AsyncOperationBase.cs:322] UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1<TObject_REF>:InvokeCompletionEvent ()
    0x00000000469D93E3 (Mono JIT Code) [D:\emp_2\EMP\Assets\Common\Extension\com.unity.addressables@1.3.3\Runtime\ResourceManager\AsyncOperations\AsyncOperationBase.cs:380] UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1<TObject_REF>:Complete (TObject_REF,bool,string)
    0x00000000469D84BB (Mono JIT Code) [D:\emp_2\EMP\Assets\Common\Extension\com.unity.addressables@1.3.3\Runtime\ResourceManager\AsyncOperations\ProviderOperation.cs:120] UnityEngine.ResourceManagement.AsyncOperations.ProviderOperation`1<TObject_REF>:providerCompleted<T_REF> (T_REF,bool,System.Exception)
    0x00000000469D7B3F (Mono JIT Code) [D:\emp_2\EMP\Assets\Common\Extension\com.unity.addressables@1.3.3\Runtime\ResourceManager\ResourceProviders\IResourceProvider.cs:107] UnityEngine.ResourceManagement.ResourceProviders.ProvideHandle:Complete<T_REF> (T_REF,bool,System.Exception)
    0x000000005E44AEF3 (Mono JIT Code) [D:\emp_2\EMP\Assets\Common\Extension\com.unity.addressables@1.3.3\Runtime\ResourceManager\ResourceProviders\AssetDatabaseProvider.cs:89] UnityEngine.ResourceManagement.ResourceProviders.AssetDatabaseProvider/InternalOp:LoadImmediate ()
    0x000000004BD65C50 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    0x00007FF8A244B970 (mono-2.0-bdwgc) [c:\users\bokken\builds\vm\mono\mono\mini\mini-runtime.c:2809] mono_jit_runtime_invoke
    0x00007FF8A23D1922 (mono-2.0-bdwgc) [c:\users\bokken\builds\vm\mono\mono\metadata\object.c:2919] do_runtime_invoke
    0x00007FF8A23DAAF2 (mono-2.0-bdwgc) [c:\users\bokken\builds\vm\mono\mono\metadata\object.c:3071] mono_runtime_invoke_checked
    0x00007FF8A23DB289 (mono-2.0-bdwgc) [c:\users\bokken\builds\vm\mono\mono\metadata\object.c:5262] mono_runtime_try_invoke_array
    0x00007FF8A23DAA86 (mono-2.0-bdwgc) [c:\users\bokken\builds\vm\mono\mono\metadata\object.c:5140] mono_runtime_invoke_array_checked
    0x00007FF8A237FB84 (mono-2.0-bdwgc) [c:\users\bokken\builds\vm\mono\mono\metadata\icall.c:3358] ves_icall_InternalInvoke
    0x000000003F860436 (Mono JIT Code) (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
    0x000000003F83EF6B (Mono JIT Code) System.Reflection.MonoMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
    0x000000004207A25F (Mono JIT Code) System.Reflection.MethodBase:Invoke (object,object[])
    0x000000005E449D03 (Mono JIT Code) System.Delegate:DynamicInvokeImpl (object[])
    0x000000005E44940B (Mono JIT Code) System.MulticastDelegate:DynamicInvokeImpl (object[])
    0x000000005E4492E5 (Mono JIT Code) System.Delegate:DynamicInvoke (object[])
    0x000000005E449023 (Mono JIT Code) [D:\emp_2\EMP\Assets\Common\Extension\com.unity.addressables@1.3.3\Runtime\ResourceManager\Util\DelayedActionManager.cs:48] UnityEngine.ResourceManagement.Util.DelayedActionManager/DelegateInfo:Invoke ()
    0x000000004AD53193 (Mono JIT Code) [D:\emp_2\EMP\Assets\Common\Extension\com.unity.addressables@1.3.3\Runtime\ResourceManager\Util\DelayedActionManager.cs:190] UnityEngine.ResourceManagement.Util.DelayedActionManager:InternalLateUpdate (single)
    0x000000004AD52A8B (Mono JIT Code) [D:\emp_2\EMP\Assets\Common\Extension\com.unity.addressables@1.3.3\Runtime\ResourceManager\Util\DelayedActionManager.cs:169] UnityEngine.ResourceManagement.Util.DelayedActionManager:LateUpdate ()
    0x000000004BD65AD8 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    0x00007FF8A244B970 (mono-2.0-bdwgc) [c:\users\bokken\builds\vm\mono\mono\mini\mini-runtime.c:2809] mono_jit_runtime_invoke
    0x00007FF8A23D1922 (mono-2.0-bdwgc) [c:\users\bokken\builds\vm\mono\mono\metadata\object.c:2919] do_runtime_invoke
    0x00007FF8A23DA91F (mono-2.0-bdwgc) [c:\users\bokken\builds\vm\mono\mono\metadata\object.c:2966] mono_runtime_invoke
    0x0000000140C0CA0A (Unity) scripting_method_invoke
    0x0000000140BFCC6A (Unity) ScriptingInvocation::Invoke
    0x0000000140BC57B7 (Unity) MonoBehaviour::CallMethodIfAvailable
    0x0000000140BC5ED1 (Unity) MonoBehaviour::CallUpdateMethod
    0x00000001406F783C (Unity) BaseBehaviourManager::CommonUpdate<LateBehaviourManager>
    0x00000001406FDC86 (Unity) LateBehaviourManager::Update
    0x0000000140968BC3 (Unity) `InitPlayerLoopCallbacks'::`2'::preLateUpdateScriptRunBehaviourLateUpdateRegistrator::Forward
    0x00000001409679F7 (Unity) ExecutePlayerLoop
    0x0000000140967AC3 (Unity) ExecutePlayerLoop
    0x000000014096AD81 (Unity) PlayerLoop
    0x000000014135307F (Unity) PlayerLoopController::UpdateScene
    0x0000000141351050 (Unity) Application::TickTimer
    0x00000001414AE413 (Unity) MainMessageLoop
    0x00000001414B00FD (Unity) WinMain
    0x00000001424A54FA (Unity) __scrt_common_main_seh
    0x00007FF8C6A47BD4 (KERNEL32) BaseThreadInitThunk
    0x00007FF8C7F2CED1 (ntdll) RtlUserThreadStart

    ========== END OF STACKTRACE ===========
     
  2. chris_unity799

    chris_unity799

    Joined:
    Mar 31, 2019
    Posts:
    1
    I'm still seeing this crash in Unity 2018.4.21 and now have a 100% repro BUT only in our full project which Unity has never been willing to look at because it is 200gb. I'll keep searching for a work around.
     
  3. DevilCult

    DevilCult

    Joined:
    Jun 24, 2017
    Posts:
    60
    If you are using GameObject.Instantiate im not sure how its gonna work. Its just Instantiate.