A question about bark

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
LeonZhu
Posts: 10
Joined: Wed Jun 15, 2022 5:36 am

A question about bark

Post by LeonZhu »

Hello, I'm back again. This time my question is that I added some characters generated by prefabs in the scene. I added the DialogueActor component to these characters and also added the Dialogue Manager to the scene. Then, I used an action from Behavior Designer, the code looks something like this:

Code: Select all

public override void OnStart()
{
    BarkDialogue();  // Automatically triggers the dialogue
}

// Implement the Bark functionality
private void BarkDialogue()
{
    DialogueManager.Bark("Bark", transform);  // Trigger Bark
}

// You can implement other logic for the Task here
public override TaskStatus OnUpdate()
{
    return TaskStatus.Success;
}
However, when the character runs, it gives me the following prompt:
MissingReferenceException: The object of type 'PixelCrushers.DialogueSystem.Wrappers.StandardBarkUI' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.

Could you please help me figure out what the issue is?
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: A question about bark

Post by Tony Li »

Hi,

In DialogueManager.Bark("Bark", transform), confirm that transform is the barking character, and that it has a bark UI in its hierarchy. Maybe it's using the wrong transform, or maybe the character is missing its bark UI for some reason.
LeonZhu
Posts: 10
Joined: Wed Jun 15, 2022 5:36 am

Re: A question about bark

Post by LeonZhu »

ok, I'll try it. Thank you.
LeonZhu
Posts: 10
Joined: Wed Jun 15, 2022 5:36 am

Re: A question about bark

Post by LeonZhu »

You’re right, I tested it and found that in the prefab, BarkUI is correctly set, but after the prefab is instantiated, it’s gone. I suspect this is because I’m using another plugin on this prefab that changes the character’s appearance...

In that case, I think I could reload BarkUI during initialization, but I ran into a problem: BarkUI isn’t actually a GameObject? Because when I tried to set it using _dialogueActor.barkUISettings.barkUI, my compiler told me it needs an AbstractUI, but the standard BarkUI in the directory (Bubble Template Standard Bark UI) is a GameObject?
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: A question about bark

Post by Tony Li »

Hi,

You can use StandardBarkUI. It's a subclass of AbstractBarkUI, which is an implementation of the IBarkUI C# interface. StandardBarkUI must be on a GameObject.
LeonZhu
Posts: 10
Joined: Wed Jun 15, 2022 5:36 am

Re: A question about bark

Post by LeonZhu »

Thank you, finally I solved the problem.
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: A question about bark

Post by Tony Li »

Glad to help!
Post Reply