UnobservedTaskException:System.ArgumentException

Posted: 13 Nov 2020 16:48
by kanako240kanako

Hi. I'm a novice of Naninovel. So please accept my apology if I post a silly question.

I created a project and just added a character, a background and a BGM. I saved the project and my script worked properly on a play mode.
Then I exited the Unity and I opened the Unity again, and then I tried to play my script on play mode and saw the error in console as below.
It would be great if one of you tell me how to fix it.

  • Unity version: 2019.4.14f1

  • Naninovel version: v1.14 build 2020-11-09

Thank you very much in advance.

Code: Select all

UnobservedTaskException:System.ArgumentException: The Object you want to instantiate is null.
  at UnityEngine.Object.CheckNullArgument (System.Object arg, System.String message) [0x00009] in <9674024ab0e74d27bbe9eaa30dab34d1>:0 
  at UnityEngine.Object.Instantiate[T] (T original) [0x00001] in <9674024ab0e74d27bbe9eaa30dab34d1>:0 
  at Naninovel.RuntimeInitializer+<InitializeAsync>d__4.MoveNext () [0x0016c] in D:\myProject\Assets\Naninovel\Runtime\Engine\RuntimeInitializer.cs:63 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <9577ac7a62ef43179789031239ba8798>:0 
  at UniRx.Async.UniTaskCompletionSource.UniRx.Async.IAwaiter.GetResult () [0x00026] in D:\myProject\Assets\Naninovel\ThirdParty\UniTask\UniRx.Async\UniTaskCompletionSource.cs:112 
  at UniRx.Async.UniTask.GetResult () [0x0000f] in D:\myProject\Assets\Naninovel\ThirdParty\UniTask\UniRx.Async\UniTask.cs:59 
  at UniRx.Async.UniTask+Awaiter.GetResult () [0x00000] in D:\myProject\Assets\Naninovel\ThirdParty\UniTask\UniRx.Async\UniTask.cs:226 
  at UniRx.Async.UniTaskExtensions+<ForgetCore>d__19.MoveNext () [0x0001b] in D:\myProject\Assets\Naninovel\ThirdParty\UniTask\UniRx.Async\UniTaskExtensions.cs:198 
UnityEngine.Debug:LogError(Object)
UniRx.Async.UniTaskScheduler:PublishUnobservedTaskException(Exception) (at Assets/Naninovel/ThirdParty/UniTask/UniRx.Async/UniTaskScheduler.cs:66)
UniRx.Async.CompilerServices.AsyncUniTaskVoidMethodBuilder:SetException(Exception) (at Assets/Naninovel/ThirdParty/UniTask/UniRx.Async/CompilerServices/AsyncUniTaskVoidMethodBuilder.cs:31)
UniRx.Async.<ForgetCore>d__19:MoveNext() (at Assets/Naninovel/ThirdParty/UniTask/UniRx.Async/UniTaskExtensions.cs:198)
UniRx.Async.CompilerServices.AsyncUniTaskVoidMethodBuilder:Start(<ForgetCore>d__19&) (at Assets/Naninovel/ThirdParty/UniTask/UniRx.Async/CompilerServices/AsyncUniTaskVoidMethodBuilder.cs:79)
UniRx.Async.UniTaskExtensions:ForgetCore(UniTask)
UniRx.Async.UniTaskExtensions:Forget(UniTask) (at Assets/Naninovel/ThirdParty/UniTask/UniRx.Async/UniTaskExtensions.cs:180)
Naninovel.RuntimeInitializer:OnApplicationLoaded() (at Assets/Naninovel/Runtime/Engine/RuntimeInitializer.cs:153)

Re: UnobservedTaskException:System.ArgumentException

Posted: 13 Nov 2020 16:51
by Elringus

Hi, Make sure the resources you've added in the configuration menus (chars, backs, etc) are valid. The references could become invalid, if you didn't save the project before exiting the Unity editor. Reinstalling Naninovel (delete Naninovel folder and import the package from the store) could also resolve the issue. If it won't help, please contact the support: https://naninovel.com/support/#developer-support


Re: UnobservedTaskException:System.ArgumentException

Posted: 14 Nov 2020 09:48
by kanako240kanako

Hello Elringus,

Thank you for your quick reply. I checked the setting of all my objects and yes, I found my mistake. I corrected it and voilà! The problem has gone as you mentioned! Thank you so much for your help. You are the star!!!

Elringus wrote: 13 Nov 2020 16:51

Hi, Make sure the resources you've added in the configuration menus (chars, backs, etc) are valid. The references could become invalid, if you didn't save the project before exiting the Unity editor. Reinstalling Naninovel (delete Naninovel folder and import the package from the store) could also resolve the issue. If it won't help, please contact the support: https://naninovel.com/support/#developer-support


Re: UnobservedTaskException:System.ArgumentException

Posted: 02 Dec 2020 16:38
by Piroshi

Hi I have the same error, in my case the first time I run the project I got the error.
What I do is to add the line RuntimeInitializer.InitializeAsync();

in the start method of an script in the scene, run it, stop it, delete the line and the problem is solve but if I make a build in Android I got the error when the engine tries to spawn the first character.

Do I need to make a previous initialization ?

Thanks in advance


Re: UnobservedTaskException:System.ArgumentException

Posted: 02 Dec 2020 20:09
by Elringus
Piroshi wrote: 02 Dec 2020 16:38

Hi I have the same error, in my case the first time I run the project I got the error.
What I do is to add the line RuntimeInitializer.InitializeAsync();

in the start method of an script in the scene, run it, stop it, delete the line and the problem is solve but if I make a build in Android I got the error when the engine tries to spawn the first character.

Do I need to make a previous initialization ?

Thanks in advance

Hi, Please contact the support via Discord and share full log of the error.