My current workflow is:
add a node -> set up the sequence -> play and test it
then again
add a node -> set up the sequence -> play and test it
after a few nodes, this process gets very slow and trying to test node 10 for example (multiple times) has me going through all of the other nodes. This might take a lot of time especially when having a dialogue and multiple sequences for each node.
Is there a way of starting a conversation from a specific node and having all the previous sequences run so that I don't miss important setups until the node I'm trying to test?
I see there is an option "Play from here..", but it does not work as expected or I'm not understanding it fully.
How to get faster iterations
Re: How to get faster iterations
Hi,
If you right-click on a node and select "Play from here..." then:
If you right-click on a node and select "Play from here..." then:
- If you're not in play mode, an editor window will open that will let you step through the conversation's text.
- If you are in play mode and a conversation is active, the conversation will jump to that node. It will skip any nodes between the current node and the selected node. This is because it can't always guarantee a straight path to the node. Take the conversation below for example: If the conversation were on "Enter door 1 or 2?" and you were to right-click on "What do you do?" and select "Play from here," should the conversation have taken the left branch or the right branch?
Re: How to get faster iterations
Oh ok, Thanks.
In my case, I don't have options, just a linear dialogue, so it would be fine if it could take that path.
In my case, I don't have options, just a linear dialogue, so it would be fine if it could take that path.
Re: How to get faster iterations
In that case you could use a subclass of DialogueSystemTrigger that, if you've specified a starting entry, plays the sequences of all entries leading up to the starting entry and then starts the conversation. Here's an example:
DS_SkipForwardExample_2024-09-02.unitypackage
and here's the script from the example:
The example scene starts a conversation at the third entry. The first two entries have Sequences that activate a Cube and a Sphere. If you play the scene, you'll see that it activates the Cube and Sphere before the third entry activates a Capsule.
DS_SkipForwardExample_2024-09-02.unitypackage
and here's the script from the example:
DialogueSystemTriggerWithSkipForward.cs
Code: Select all
using UnityEngine;
namespace PixelCrushers.DialogueSystem
{
public class DialogueSystemTriggerWithSkipForward : DialogueSystemTrigger
{
protected override void DoConversationAction(Transform actor)
{
if (startConversationEntryID > 0)
{
// Assumes linear conversation:
int entryID = 0;
int safeguard = 0;
int MaxConversationLength = 1000; // Safeguard to prevent infinite loop.
var entries = DialogueManager.masterDatabase.GetConversation(conversation).dialogueEntries;
while (entryID != startConversationEntryID && safeguard++ < MaxConversationLength)
{
var entry = entries.Find(x => x.id == entryID);
if (entry == null) break;
var sequence = entry.Sequence.
Replace(@"{{default}}", DialogueManager.displaySettings.cameraSettings.defaultSequence).
Replace(@"{{end}}", "0");
if (!string.IsNullOrEmpty(sequence))
{
// Play sequence and immediately stop so only 'required' play.
var sequencer = DialogueManager.PlaySequence(sequence);
DialogueManager.StopSequence(sequencer);
}
if (entry.outgoingLinks.Count == 0) break;
entryID = entry.outgoingLinks[0].destinationDialogueID;
}
}
base.DoConversationAction(actor);
}
}
}
Spoiler
The example scene starts a conversation at the third entry. The first two entries have Sequences that activate a Cube and a Sphere. If you play the scene, you'll see that it activates the Cube and Sphere before the third entry activates a Capsule.
Re: How to get faster iterations
Glad to help!