MissingReferenceException ChoiceHandlerButton in Simple Project

The engine is not working as expected? Documentation is wrong or out of date? Let us know here!
Forum rules
We are not providing support via this forum; it's community-driven. For official support see https://naninovel.com/support/#naninovel-support
Post Reply
Furious
Posts: 2
Joined: 21 Apr 2023 19:23

MissingReferenceException ChoiceHandlerButton in Simple Project

Post by Furious »

Hi there, I have started getting this error in my simple project.

This always happens after the scripts show one set of choices, followed by a second set and then a text block.

This is how it happens:

1) Text
2) 2 Choices
3) Text
4) 2 Choices
5) Text <-- breaks here

The project was not doing this before, so I seem to have gotten it into a weird state; any idea what the problem could be?

The CommandParameterData.getValue lambda in ChoiceHandlerData.AddCommandParameters is referencing null 'choice'. If I add a null check in there it suppresses the problem, though I suspect there is still an underlying problem.

Thanks!

Code: Select all

UnityEngine.MissingReferenceException: The object of type 'ChoiceHandlerButton' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
  at (wrapper managed-to-native) UnityEngine.Component.get_transform(UnityEngine.Component)
  at NaninovelSceneAssistant.ChoiceHandlerData+<>c__DisplayClass8_0.<AddCommandParameters>b__0 () [0x00000] in G:\Projects\SOD\SoD\Assets\Standard Assets\NaninovelSceneAssistant\ObjectData\Data\ActorData.cs:148 
  at (wrapper delegate-invoke) System.Func`1[UnityEngine.Vector2].invoke_TResult()
  at NaninovelSceneAssistant.CommandParameterData`1[T].get_Value () [0x00000] in G:\Projects\SOD\SoD\Assets\Standard Assets\NaninovelSceneAssistant\ObjectData\Values\CommandParameterData.cs:52 
  at NaninovelSceneAssistant.CommandParameterData`1[T].HandleCommandFinished (Naninovel.Command command) [0x00001] in G:\Projects\SOD\SoD\Assets\Standard Assets\NaninovelSceneAssistant\ObjectData\Values\CommandParameterData.cs:94 
  at (wrapper delegate-invoke) System.Func`2[Naninovel.Command,Naninovel.UniTask].invoke_TResult_T(Naninovel.Command)
  at Naninovel.ScriptPlayer.ExecutePlayedCommandAsync (Naninovel.AsyncToken asyncToken) [0x005c0] in G:\Projects\SOD\SoD\Assets\Standard Assets\Naninovel\Runtime\ScriptPlayer\ScriptPlayer.cs:571 
  at Naninovel.UniTaskCompletionSource.Naninovel.Async.IAwaiter.GetResult () [0x0001f] in G:\Projects\SOD\SoD\Assets\Standard Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTaskCompletionSource.cs:91 
  at Naninovel.UniTask.GetResult () [0x00001] in G:\Projects\SOD\SoD\Assets\Standard Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTask.cs:46 
  at Naninovel.UniTask+Awaiter.GetResult () [0x00000] in G:\Projects\SOD\SoD\Assets\Standard Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTask.cs:201 
  at Naninovel.ScriptPlayer.PlayRoutineAsync (Naninovel.AsyncToken asyncToken) [0x002b0] in G:\Projects\SOD\SoD\Assets\Standard Assets\Naninovel\Runtime\ScriptPlayer\ScriptPlayer.cs:622 
  at Naninovel.UniTaskCompletionSource.Naninovel.Async.IAwaiter.GetResult () [0x0001f] in G:\Projects\SOD\SoD\Assets\Standard Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTaskCompletionSource.cs:91 
  at Naninovel.UniTask.GetResult () [0x00001] in G:\Projects\SOD\SoD\Assets\Standard Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTask.cs:46 
  at Naninovel.UniTask+Awaiter.GetResult () [0x00000] in G:\Projects\SOD\SoD\Assets\Standard Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTask.cs:201 
  at Naninovel.UniTaskExtensions.ForgetCore (Naninovel.UniTask task) [0x0001b] in G:\Projects\SOD\SoD\Assets\Standard Assets\Naninovel\Runtime\Common\Async\UniTask\Public\UniTaskExtensions.cs:189 
UnityEngine.Debug:LogError (object)
Naninovel.Async.UniTaskScheduler:PublishUnobservedTaskException (System.Exception) (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/UniTaskScheduler.cs:65)
Naninovel.Async.CompilerServices.AsyncUniTaskVoidMethodBuilder:SetException (System.Exception) (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/AsyncUniTaskVoidMethodBuilder.cs:29)
Naninovel.UniTaskExtensions/<ForgetCore>d__11:MoveNext () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskExtensions.cs:189)
Naninovel.Async.CompilerServices.MoveNextRunner`1<Naninovel.UniTaskExtensions/<ForgetCore>d__11>:Run () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/MoveNextRunner.cs:16)
Naninovel.UniTaskCompletionSource:TryInvokeContinuation () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskCompletionSource.cs:149)
Naninovel.UniTaskCompletionSource:TrySetException (System.Exception) (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskCompletionSource.cs:178)
Naninovel.Async.CompilerServices.AsyncUniTaskMethodBuilder:SetException (System.Exception) (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/AsyncUniTaskMethodBuilder.cs:57)
Naninovel.ScriptPlayer/<PlayRoutineAsync>d__131:MoveNext () (at Assets/Standard Assets/Naninovel/Runtime/ScriptPlayer/ScriptPlayer.cs:605)
Naninovel.Async.CompilerServices.MoveNextRunner`1<Naninovel.ScriptPlayer/<PlayRoutineAsync>d__131>:Run () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/MoveNextRunner.cs:16)
Naninovel.UniTaskCompletionSource:TryInvokeContinuation () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskCompletionSource.cs:149)
Naninovel.UniTaskCompletionSource:TrySetException (System.Exception) (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskCompletionSource.cs:178)
Naninovel.Async.CompilerServices.AsyncUniTaskMethodBuilder:SetException (System.Exception) (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/AsyncUniTaskMethodBuilder.cs:57)
Naninovel.ScriptPlayer/<ExecutePlayedCommandAsync>d__128:MoveNext () (at Assets/Standard Assets/Naninovel/Runtime/ScriptPlayer/ScriptPlayer.cs:585)
Naninovel.Async.CompilerServices.MoveNextRunner`1<Naninovel.ScriptPlayer/<ExecutePlayedCommandAsync>d__128>:Run () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/MoveNextRunner.cs:16)
Naninovel.UniTaskCompletionSource:TryInvokeContinuation () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskCompletionSource.cs:149)
Naninovel.UniTaskCompletionSource:TrySetResult () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskCompletionSource.cs:167)
Naninovel.Async.CompilerServices.AsyncUniTaskMethodBuilder:SetResult () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/AsyncUniTaskMethodBuilder.cs:72)
Naninovel.ScriptPlayer/<ExecuteIgnoringCancellationAsync>d__130:MoveNext () (at Assets/Standard Assets/Naninovel/Runtime/ScriptPlayer/ScriptPlayer.cs:601)
Naninovel.Async.CompilerServices.MoveNextRunner`1<Naninovel.ScriptPlayer/<ExecuteIgnoringCancellationAsync>d__130>:Run () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/MoveNextRunner.cs:16)
Naninovel.UniTaskCompletionSource:TryInvokeContinuation () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskCompletionSource.cs:149)
Naninovel.UniTaskCompletionSource:TrySetResult () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskCompletionSource.cs:167)
Naninovel.Async.CompilerServices.AsyncUniTaskMethodBuilder:SetResult () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/AsyncUniTaskMethodBuilder.cs:72)
Naninovel.Commands.PrintText/<ExecuteAsync>d__28:MoveNext () (at Assets/Standard Assets/Naninovel/Runtime/Command/Printer/PrintText.cs:156)
Naninovel.Async.CompilerServices.MoveNextRunner`1<Naninovel.Commands.PrintText/<ExecuteAsync>d__28>:Run () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/MoveNextRunner.cs:16)
Naninovel.UniTaskCompletionSource:TryInvokeContinuation () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskCompletionSource.cs:149)
Naninovel.UniTaskCompletionSource:TrySetResult () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTaskCompletionSource.cs:167)
Naninovel.Async.CompilerServices.AsyncUniTaskMethodBuilder:SetResult () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/AsyncUniTaskMethodBuilder.cs:72)
Naninovel.AsyncUtils/<DelayFrameAsync>d__3:MoveNext () (at Assets/Standard Assets/Naninovel/Runtime/Common/Utilities/AsyncUtils.cs:29)
Naninovel.Async.CompilerServices.MoveNextRunner`1<Naninovel.AsyncUtils/<DelayFrameAsync>d__3>:Run () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/MoveNextRunner.cs:16)
Naninovel.Async.Internal.ReusablePromise`1<int>:TryInvokeContinuation () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/Internal/ReusablePromise.cs:232)
Naninovel.Async.Internal.ReusablePromise`1<int>:TrySetResult (int) (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/Internal/ReusablePromise.cs:219)
Naninovel.UniTask/DelayFramePromise:MoveNext () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/Public/UniTask.Delay.cs:84)
Naninovel.Async.Internal.PlayerLoopRunner:RunCore () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/Internal/PlayerLoopRunner.cs:174)
Naninovel.Async.Internal.PlayerLoopRunner:Update () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/Internal/PlayerLoopRunner.cs:144)
Naninovel.Async.Internal.PlayerLoopRunner:Run () (at Assets/Standard Assets/Naninovel/Runtime/Common/Async/UniTask/Internal/PlayerLoopRunner.cs:103)
idaot
support
Posts: 262
Joined: 01 Aug 2020 08:25

Re: MissingReferenceException ChoiceHandlerButton in Simple Project

Post by idaot »

This is a harmless bug that occurs when using Naninovel Scene Assistant. I am working on a fix.

Furious
Posts: 2
Joined: 21 Apr 2023 19:23

Re: MissingReferenceException ChoiceHandlerButton in Simple Project

Post by Furious »

Got it - thanks!

idaot
support
Posts: 262
Joined: 01 Aug 2020 08:25

Re: MissingReferenceException ChoiceHandlerButton in Simple Project

Post by idaot »

The bug has been fixed in the latest version (2.2.0) - thanks for letting me know of the issue!

Post Reply