Issue with setting conversation in c#

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
astroimpossible
Posts: 7
Joined: Thu Jun 29, 2017 5:43 am

Issue with setting conversation in c#

Post by astroimpossible »

Hi, I've come across a small issue when setting a conversation in c# for an NPC. I'm using something like:

NPC.GetComponent<ConversationTrigger>().conversation = "Example/Conversation";

This results in a "Conversation not found in database" warning. However, if I set it to a conversation not in a subfolder, e.g. just "Conversation", it works fine. So basically it's not currently working for any conversation I have in a sub folder. I have a feeling I'm missing something obvious, but coffee isn't helping my brain figure it out. Any help would be appreciated!
User avatar
Tony Li
Posts: 22062
Joined: Thu Jul 18, 2013 1:27 pm

Re: Issue with setting conversation in c#

Post by Tony Li »

Hi!

That should work. Are you perhaps using a backslash ( \ )? If so, this will cause C# to interpret it as a special character (e.g., "\n" is a newline). Or is there a blank space somewhere in the conversation title (e.g., "Example /Conversation")? (Note the blank space at the end of "Example ".) Also, try using a literal string such as @"Example/Conversation":

Code: Select all

NPC.GetComponent<ConversationTrigger>().conversation = @"Example/Conversation";
astroimpossible
Posts: 7
Joined: Thu Jun 29, 2017 5:43 am

Re: Issue with setting conversation in c#

Post by astroimpossible »

*slaps forehead* You were right, there's a space in the conversation title I was testing. Problem solved. Thanks!
User avatar
Tony Li
Posts: 22062
Joined: Thu Jul 18, 2013 1:27 pm

Re: Issue with setting conversation in c#

Post by Tony Li »

Happy to help!
Post Reply