Page 1 of 2

Visual Scripting integration

Posted: Mon Mar 21, 2022 8:17 am
by cupntea
Hi,
I'm using Unity 2021.2 where Bolt has been fully integrated into Unity and now called Visual Scripting. I read manual from PixelCrushers, but it seems dated as it only has a section about Bolt.
How do I read a variable from Dialogue System conversation to create On Event action, for instance?

Thank you in advance!

Re: Visual Scripting integration

Posted: Mon Mar 21, 2022 8:43 am
by Tony Li
Hi,

Integration with Unity's Visual Scripting package has been added to the upcoming version 2.2.26. You can download the integration right now from the Dialogue System Extras page.

Re: Visual Scripting integration

Posted: Mon Mar 21, 2022 11:44 am
by cupntea
Thank you kindly for the reply.
Is there a documentation available for it?

Re: Visual Scripting integration

Posted: Mon Mar 21, 2022 12:51 pm
by Tony Li
The online manual will be updated with version 2.2.26. For now, you can use the Bolt Integration documentation. It's mostly the same.

Re: Visual Scripting integration

Posted: Mon Mar 21, 2022 5:16 pm
by cupntea
Kindly asking you to assist me with this.
What I want is to react Visual Scripting on Dialogue System events.
What I've done to achieve that:
1. Added the nodes "DialogueSystem" and "PixelCrushers" to the Visual Scripting blade, as well as "Dialogue Manager" and "Dialogue Lua" into Type Options. (I use evaluation version).
2. Imported "DialogueSystem_2_2_25_Evaluation_Unity2019_3_plus.unitypackage" and "DS_VisualScriptingSupport_2022-03-08.unitypackage" custom packages.
3. Created Scene as per Quick Start guide.
4. Added "Visual Scripting / Script Machine" to Main Camera object to change its position based on Conversation Line.
5. Added "Dialogue System Visual Scripting Custom Event" component into Main Camera object to get events from Dialogue Manager.
6. in the Graph I created "Custom Event" as per "Dialogue System Bolt Custom Events" and it doesn't work. I tried to create an event "On Conversation Start" from Dialogue System Events as shown on the screenshot, but I'm not able to choose an Actor (no actors available).
Can you please assist, what I do wrong?
Image

Re: Visual Scripting integration

Posted: Mon Mar 21, 2022 5:23 pm
by Tony Li
Hi,

To prevent broadcasting events to everything in the scene, Dialogue System events are sent only to the Dialogue Manager GameObject and the conversation's two primary participant GameObjects. (See Character GameObject Assignments.)

If you put the Dialogue System Visual Scripting Custom Events component on the Dialogue Manager or a conversation participant, it should receive the events.

Keep in mind that the Dialogue Manager is by default a "Don't Destroy On Load" GameObject. You should only assign inspector references to GameObjects in its hierarchy or in the hierarchy of other "Don't Destroy On Load" GameObjects. Otherwise those references will become invalid when you change scenes. If you need to assign a reference to a regular scene object, add the Dialogue System Visual Scripting Custom Events component to one of the conversation's participants instead.

Re: Visual Scripting integration

Posted: Mon Mar 21, 2022 7:18 pm
by cupntea
If you need to assign a reference to a regular scene object, add the Dialogue System Visual Scripting Custom Events component to one of the conversation's participants instead.
Well, I tried with Dialogue Manager and it's not working for me neither. Below is the example of me trying to trigger event OnConversationStart from NPC GameObject and nothing comes out of it.
Image
Any ideas what I've been doing wrong?
Essentially, what I want to achieve is to change background of conversation once one or another conversation starts.

Re: Visual Scripting integration

Posted: Mon Mar 21, 2022 8:51 pm
by Tony Li
Hi,

That should work, but alerts aren't shown when a conversation is active. You can change this by ticking the Dialogue Manager GameObject's Display Settings > Alert Settings > Allow Alerts During Conversations.

Re: Visual Scripting integration

Posted: Tue Mar 22, 2022 6:53 am
by cupntea
Unfortunately it's not working.
Could it be the reason that I'm using the Evaluation version?
Would you able to make a sample scene for me on 2021.2, so I could check how it should work?

Re: Visual Scripting integration

Posted: Tue Mar 22, 2022 9:20 am
by Tony Li
Hi,

This example should work in the evaluation version or the Asset Store version:

DS_VisualScriptingExample_2022-03-22.unitypackage

One note: When starting a conversation when the scene starts, it's best to set the Dialogue System Trigger to OnSaveDataApplied instead of OnStart. This way, if a scene transition or load game is in progress, it will properly wait for the save data to be applied before starting the conversation. If no scene transition or load game is in progress, it will start right away (technically, after the same number of frames as it would take the save system to apply data, which is 1 frame by default).

When you play the example scene, it will show an alert in the center of the screen, and conversation text will appear at the top of the screen.