Page 1 of 1
How to get faster iterations
Posted: Fri Aug 30, 2024 12:07 pm
by paul2205
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.
Re: How to get faster iterations
Posted: Fri Aug 30, 2024 3:20 pm
by Tony Li
Hi,
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:
- branches.png (23.59 KiB) Viewed 227 times
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
Posted: Mon Sep 02, 2024 4:28 pm
by paul2205
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.
Re: How to get faster iterations
Posted: Mon Sep 02, 2024 5:01 pm
by Tony Li
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:
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);
}
}
}
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
Posted: Tue Sep 03, 2024 12:52 pm
by paul2205
Thank you
Re: How to get faster iterations
Posted: Tue Sep 03, 2024 2:26 pm
by Tony Li
Glad to help!