I have started using many variables through DSU in my prototype, and mostly for setting up conversation and scenario conditions. However, I really would like to track those while debugging the story. Is there a way to figure out what the value of a given variable is at a given time?
Thank you.
How to keep track of variables?
Re: How to keep track of variables?
Hi,
Yes, several ways. In the Unity editor, the Dialogue Editor window's Templates tab turns into a Watches tab during play. You can add watches on variables, quest states, and more.
You can also add a Lua Console component to the Dialogue Manager. During play, press ~+L to open the console and enter expressions such as:
to show the values of all variables, or:
to show the value of the variable Foo. This is handy in builds where you can't access the Dialogue Editor window. You can also register your own C# methods with Lua and use them in the Lua Console. Since you're using Opsive UCC, you can use the UCC Lua Functions to give items, add health, etc.
You can get the value of a variable in a script using DialogueLua.GetVariable or an equivalent visual scripting action, or add a Lua Observer.
Yes, several ways. In the Unity editor, the Dialogue Editor window's Templates tab turns into a Watches tab during play. You can add watches on variables, quest states, and more.
You can also add a Lua Console component to the Dialogue Manager. During play, press ~+L to open the console and enter expressions such as:
Code: Select all
return Variable
Code: Select all
return Variable["Foo"]
You can get the value of a variable in a script using DialogueLua.GetVariable or an equivalent visual scripting action, or add a Lua Observer.
Re: How to keep track of variables?
This is awesome. Thank you Tony.
Re: How to keep track of variables?
This feature is so helpful. I could not figure out what kept messing one of the variables, and I caught it this time. It was a changed hidden within a silly bark that I even forgot that I had set up much earlier.
Re: How to keep track of variables?
Glad you found it! There's also the Dialogue Manager's Debug Level > Info. But while it can provide all the sordid details of when Script and Conditions fields run, it's a lot to pick through.