How does fusion handles initially disabled network objects?

Guys, when i'm loading a scene containing disabled NetworkRigidbody, I'm getting a null ref exception from Fusion.NetworkRigidbody.CopyFromEngineToBuffer. Do I need some special handling for disabled stuff like that?

Answers

  • Hi @Klimashin,

    Which SDK version is being used?

    Would you also be able to share the stack trace of the exception, please?

  • Hey, Daniel! It's version 1.1.1

    Here is full stack trace (it's too big to just post it here)


  • It's version 1.1.1

    Here is full stack trace:

    System.NullReferenceException: Object reference not set to an instance of an object

     at Fusion.NetworkRigidbody.CopyFromEngineToBuffer () [0x0000d] in <602e1cb430e34c21b04b6ecf1f67d1a1>:0 

     at Fusion.NetworkPositionRotation.CopyBackingFieldsToState (System.Boolean firstTime) [0x0001a] in <602e1cb430e34c21b04b6ecf1f67d1a1>:0 

     at Fusion.NetworkRigidbodyBase.CopyBackingFieldsToState (System.Boolean firstTime) [0x00000] in <602e1cb430e34c21b04b6ecf1f67d1a1>:0 

     at Fusion.NetworkRunner.InitializeNetworkObjectState (Fusion.NetworkObject instance, Fusion.NetworkRunner+AttachOptions options) [0x00011] in <602e1cb430e34c21b04b6ecf1f67d1a1>:0 

     at Fusion.NetworkRunner.RegisterSceneObjects (System.Collections.Generic.IEnumerable`1[T] objects) [0x0010b] in <602e1cb430e34c21b04b6ecf1f67d1a1>:0 

     at Mayg.PhotonExtensions.CustomSceneLoader.LoadSceneInternal (Fusion.SceneRef sceneRef) [0x000c7] in /Users/klimashin/Projects/yakuza-girlfriend/Assets/Scripts/Mayg/PhotonExtensions/CustomSceneLoader.cs:168 

     at Mayg.PhotonExtensions.CustomSceneLoader.LoadScene (Fusion.SceneRef newScene) [0x00132] in /Users/klimashin/Projects/yakuza-girlfriend/Assets/Scripts/Mayg/PhotonExtensions/CustomSceneLoader.cs:52 

     at Mayg.Loaders.BaseUnits.NetworkSceneLoadUnit.Load () [0x0003c] in /Users/klimashin/Projects/yakuza-girlfriend/Assets/Scripts/Mayg/Loaders/BaseUnits/NetworkSceneLoadUnit.cs:30 

     at Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1[TResult].GetResult (System.Int16 token) [0x00067] in /Users/klimashin/Projects/yakuza-girlfriend/Library/PackageCache/[email protected]/Runtime/UniTaskCompletionSource.cs:244 

     at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].GetResult (System.Int16 token) [0x00002] in /Users/klimashin/Projects/yakuza-girlfriend/Library/PackageCache/[email protected]/Runtime/CompilerServices/StateMachineRunner.cs:218 

     at Cysharp.Threading.Tasks.UniTask+Awaiter.GetResult () [0x00015] in /Users/klimashin/Projects/yakuza-girlfriend/Library/PackageCache/[email protected]/Runtime/UniTask.cs:312 

     at Services.Loading.LoadingService.BeginLoading (Services.Loading.ILoadUnit[] units) [0x0008e] in /Users/klimashin/Projects/yakuza-girlfriend/Assets/Scripts/Services/Loading/LoadingService.cs:36 

    UnityEngine.Debug:LogError (object)

    Services.Loading.LoadingService/<BeginLoading>d__6:MoveNext () (at Assets/Scripts/Services/Loading/LoadingService.cs:44)

    Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1<Services.Loading.LoadingService/<BeginLoading>d__6>:Run () (at Library/PackageCache/[email protected]/Runtime/CompilerServices/StateMachineRunner.cs:189)

    Cysharp.Threading.Tasks.AwaiterActions:Continuation (object) (at Library/PackageCache/[email protected]/Runtime/UniTask.cs:21)

    Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1<Cysharp.Threading.Tasks.AsyncUnit>:TrySetException (System.Exception) (at Library/PackageCache/[email protected]/Runtime/UniTaskCompletionSource.cs:167)

    Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1<Mayg.Loaders.BaseUnits.NetworkSceneLoadUnit/<Load>d__5>:SetException (System.Exception) (at Library/PackageCache/[email protected]/Runtime/CompilerServices/StateMachineRunner.cs:210)

    Cysharp.Threading.Tasks.CompilerServices.AsyncUniTaskMethodBuilder:SetException (System.Exception) (at Library/PackageCache/[email protected]/Runtime/CompilerServices/AsyncUniTaskMethodBuilder.cs:59)

    Mayg.Loaders.BaseUnits.NetworkSceneLoadUnit/<Load>d__5:MoveNext () (at Assets/Scripts/Mayg/Loaders/BaseUnits/NetworkSceneLoadUnit.cs:32)

    Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1<Mayg.Loaders.BaseUnits.NetworkSceneLoadUnit/<Load>d__5>:Run () (at Library/PackageCache/[email protected]/Runtime/CompilerServices/StateMachineRunner.cs:189)

    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<UnityEngine.SceneManagement.Scene>:SetException (System.Exception)

    Mayg.PhotonExtensions.CustomSceneLoader/<LoadScene>d__16:MoveNext () (at Assets/Scripts/Mayg/PhotonExtensions/CustomSceneLoader.cs:57)

    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<UnityEngine.SceneManagement.Scene>:SetException (System.Exception)

    Mayg.PhotonExtensions.CustomSceneLoader/<LoadSceneInternal>d__24:MoveNext () (at Assets/Scripts/Mayg/PhotonExtensions/CustomSceneLoader.cs:172)

    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<UnityEngine.SceneManagement.Scene>:SetResult (UnityEngine.SceneManagement.Scene)

    Mayg.PhotonExtensions.CustomSceneLoader/<LoadSceneAsset>d__23:MoveNext () (at Assets/Scripts/Mayg/PhotonExtensions/CustomSceneLoader.cs:160)

    System.Threading.Tasks.TaskCompletionSource`1<UnityEngine.AsyncOperation>:SetResult (UnityEngine.AsyncOperation)

    Mayg.PhotonExtensions.PhotonRunnerExtensions/<>c__DisplayClass0_0:<GetAwaiter>b__0 (UnityEngine.AsyncOperation) (at Assets/Scripts/Mayg/PhotonExtensions/PhotonRunnerExtensions.cs:13)

    UnityEngine.AsyncOperation:InvokeCompletionEvent () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/AsyncOperation.cs:21)


  • It's version 1.1.1

    Here is full stack trace:

    System.NullReferenceException: Object reference not set to an instance of an object

     at Fusion.NetworkRigidbody.CopyFromEngineToBuffer () [0x0000d] in <602e1cb430e34c21b04b6ecf1f67d1a1>:0 

     at Fusion.NetworkPositionRotation.CopyBackingFieldsToState (System.Boolean firstTime) [0x0001a] in <602e1cb430e34c21b04b6ecf1f67d1a1>:0 

     at Fusion.NetworkRigidbodyBase.CopyBackingFieldsToState (System.Boolean firstTime) [0x00000] in <602e1cb430e34c21b04b6ecf1f67d1a1>:0 

     at Fusion.NetworkRunner.InitializeNetworkObjectState (Fusion.NetworkObject instance, Fusion.NetworkRunner+AttachOptions options) [0x00011] in <602e1cb430e34c21b04b6ecf1f67d1a1>:0 

     at Fusion.NetworkRunner.RegisterSceneObjects (System.Collections.Generic.IEnumerable`1[T] objects) [0x0010b] in <602e1cb430e34c21b04b6ecf1f67d1a1>:0 

     at Mayg.PhotonExtensions.CustomSceneLoader.LoadSceneInternal (Fusion.SceneRef sceneRef) [0x000c7] in /Users/klimashin/Projects/yakuza-girlfriend/Assets/Scripts/Mayg/PhotonExtensions/CustomSceneLoader.cs:168 

     at Mayg.PhotonExtensions.CustomSceneLoader.LoadScene (Fusion.SceneRef newScene) [0x00132] in /Users/klimashin/Projects/yakuza-girlfriend/Assets/Scripts/Mayg/PhotonExtensions/CustomSceneLoader.cs:52 

     at Mayg.Loaders.BaseUnits.NetworkSceneLoadUnit.Load () [0x0003c] in /Users/klimashin/Projects/yakuza-girlfriend/Assets/Scripts/Mayg/Loaders/BaseUnits/NetworkSceneLoadUnit.cs:30 

     at Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1[TResult].GetResult (System.Int16 token) [0x00067] in /Users/klimashin/Projects/yakuza-girlfriend/Library/PackageCache/[email protected]/Runtime/UniTaskCompletionSource.cs:244 

     at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].GetResult (System.Int16 token) [0x00002] in /Users/klimashin/Projects/yakuza-girlfriend/Library/PackageCache/[email protected]/Runtime/CompilerServices/StateMachineRunner.cs:218 

     at Cysharp.Threading.Tasks.UniTask+Awaiter.GetResult () [0x00015] in /Users/klimashin/Projects/yakuza-girlfriend/Library/PackageCache/[email protected]/Runtime/UniTask.cs:312 

     at Services.Loading.LoadingService.BeginLoading (Services.Loading.ILoadUnit[] units) [0x0008e] in /Users/klimashin/Projects/yakuza-girlfriend/Assets/Scripts/Services/Loading/LoadingService.cs:36 

    UnityEngine.Debug:LogError (object)

    Services.Loading.LoadingService/<BeginLoading>d__6:MoveNext () (at Assets/Scripts/Services/Loading/LoadingService.cs:44)

    Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1<Services.Loading.LoadingService/<BeginLoading>d__6>:Run () (at Library/PackageCache/[email protected]/Runtime/CompilerServices/StateMachineRunner.cs:189)

    Cysharp.Threading.Tasks.AwaiterActions:Continuation (object) (at Library/PackageCache/[email protected]/Runtime/UniTask.cs:21)

    Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1<Cysharp.Threading.Tasks.AsyncUnit>:TrySetException (System.Exception) (at Library/PackageCache/[email protected]/Runtime/UniTaskCompletionSource.cs:167)

    Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1<Mayg.Loaders.BaseUnits.NetworkSceneLoadUnit/<Load>d__5>:SetException (System.Exception) (at Library/PackageCache/[email protected]/Runtime/CompilerServices/StateMachineRunner.cs:210)

    Cysharp.Threading.Tasks.CompilerServices.AsyncUniTaskMethodBuilder:SetException (System.Exception) (at Library/PackageCache/[email protected]/Runtime/CompilerServices/AsyncUniTaskMethodBuilder.cs:59)

    Mayg.Loaders.BaseUnits.NetworkSceneLoadUnit/<Load>d__5:MoveNext () (at Assets/Scripts/Mayg/Loaders/BaseUnits/NetworkSceneLoadUnit.cs:32)

    Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1<Mayg.Loaders.BaseUnits.NetworkSceneLoadUnit/<Load>d__5>:Run () (at Library/PackageCache/[email protected]/Runtime/CompilerServices/StateMachineRunner.cs:189)

    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<UnityEngine.SceneManagement.Scene>:SetException (System.Exception)

    Mayg.PhotonExtensions.CustomSceneLoader/<LoadScene>d__16:MoveNext () (at Assets/Scripts/Mayg/PhotonExtensions/CustomSceneLoader.cs:57)

    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<UnityEngine.SceneManagement.Scene>:SetException (System.Exception)

    Mayg.PhotonExtensions.CustomSceneLoader/<LoadSceneInternal>d__24:MoveNext () (at Assets/Scripts/Mayg/PhotonExtensions/CustomSceneLoader.cs:172)

    System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<UnityEngine.SceneManagement.Scene>:SetResult (UnityEngine.SceneManagement.Scene)

    Mayg.PhotonExtensions.CustomSceneLoader/<LoadSceneAsset>d__23:MoveNext () (at Assets/Scripts/Mayg/PhotonExtensions/CustomSceneLoader.cs:160)

    System.Threading.Tasks.TaskCompletionSource`1<UnityEngine.AsyncOperation>:SetResult (UnityEngine.AsyncOperation)

    Mayg.PhotonExtensions.PhotonRunnerExtensions/<>c__DisplayClass0_0:<GetAwaiter>b__0 (UnityEngine.AsyncOperation) (at Assets/Scripts/Mayg/PhotonExtensions/PhotonRunnerExtensions.cs:13)

    UnityEngine.AsyncOperation:InvokeCompletionEvent () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/AsyncOperation.cs:21)


  • Hey, Daniel! It's version 1.1.1

    Here is full stack trace (it's too big to just post it here)

    https://pastebin.pl/view/58959763

  • Hey, Daniel! It's version 1.1.1

    Here is full stack trace (it's too big to just post it here)

    https://pastebin.pl/view/58959763

  • Hey, Daniel! It's version 1.1.1

    Here is full stack trace (it's too big to just post it here)

  • Hey, Daniel! It's version 1.1.1

    Here is full stack trace (it's too big to just post it here)

  • Hey, Daniel! It's version 1.1.1

    Here is full stack trace (it's too big to just post it here)