Is it possible to get better debug information?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Timeslip
Posts: 39
Joined: Fri Apr 05, 2019 6:31 am

Is it possible to get better debug information?

Post by Timeslip »

Hi,

I'm working on the basics of customising dialogue system for a game. After calling a registered lua function, which starts a significant chunk of code to set up characters and combat, there's no indication which part of the code is causing the problem. Is there any way to get more precise information on what's causing the problem? Output below:

Code: Select all

Dialogue System: Lua code 'StartBurningHouseCombat();' threw exception 'Exception has been thrown by the target of an invocation.'
UnityEngine.Debug:LogError(Object)
PixelCrushers.DialogueSystem.Lua:RunRaw(String, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:219)
PixelCrushers.DialogueSystem.Lua:Run(String, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:120)
PixelCrushers.DialogueSystem.ConversationModel:GetState(DialogueEntry, Boolean, Boolean, Boolean) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Logic/Model/ConversationModel.cs:233)
PixelCrushers.DialogueSystem.ConversationModel:GetState(DialogueEntry) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Model/Logic/Model/ConversationModel.cs:297)
PixelCrushers.DialogueSystem.ConversationController:OnSelectedResponse(Object, SelectedResponseEventArgs) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/Controller/ConversationController.cs:257)
PixelCrushers.DialogueSystem.ConversationView:SelectResponse(SelectedResponseEventArgs) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:454)
PixelCrushers.DialogueSystem.ConversationView:OnSelectedResponse(Object, SelectedResponseEventArgs) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/MVC/View/View/ConversationView.cs:447)
PixelCrushers.DialogueSystem.AbstractDialogueUI:OnClick(Object) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Abstract/Dialogue/AbstractDialogueUI.cs:346)
PixelCrushers.DialogueSystem.StandardDialogueUI:OnClick(Object) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Standard/Dialogue/StandardDialogueUI.cs:215)
UnityEngine.Component:SendMessage(String, Object, SendMessageOptions)
PixelCrushers.DialogueSystem.StandardUIResponseButton:OnClick() (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/UI/Standard/Dialogue/StandardUIResponseButton.cs:124)
UnityEngine.EventSystems.EventSystem:Update()
User avatar
wiverson
Posts: 22
Joined: Wed Feb 13, 2019 7:49 pm

Re: Is it possible to get better debug information?

Post by wiverson »

Just took a quick look at the Run code for Lua.cs. It is swallowing the Exception e stacktrace, as a temporary workaround you could add your own debug tracing and/or set the debugger to point at that...
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Is it possible to get better debug information?

Post by Tony Li »

@wiverson is absolutely correct about the current version. But it's a royal pain in the ass, isn't it? Here's a patch that will be in the next update:

DS_LuaPatch_2019-04-24.unitypackage

It reports the true exception. You can double-click on it in the Console window, and Unity will take you to the offending line in your code editor.
Timeslip
Posts: 39
Joined: Fri Apr 05, 2019 6:31 am

Re: Is it possible to get better debug information?

Post by Timeslip »

Hey wiverson and Tony. Thanks for getting back to me. I'll try out that package - that functionality would be really helpful.
Timeslip
Posts: 39
Joined: Fri Apr 05, 2019 6:31 am

Re: Is it possible to get better debug information?

Post by Timeslip »

While doubling clicking on the error in the Unity console window isn't opening visual studio on the line of code with the issue, it is providing the debug information on the issue. This is a HUGE timesaver, so thanks Tony.

Using Visual Studio 15.9.4 (community 2017) in conjunction with Unity 2018.2.18F1 in case that's of any use.
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Is it possible to get better debug information?

Post by Tony Li »

Hmm, I'm also using that same version, and double-clicking works. Lua functions will now throw two errors. Try double-clicking the first one, which is the true error:
luaError.png
luaError.png (11.55 KiB) Viewed 795 times
The second one is just Lua reporting that it intercepted the error.
Timeslip
Posts: 39
Joined: Fri Apr 05, 2019 6:31 am

Re: Is it possible to get better debug information?

Post by Timeslip »

Have tried clicking both. It's not a big issue though - getting the line number is a big improvement as is,
Post Reply