Different Conversation UI

Announcements, support questions, and discussion for the Dialogue System.
nrvllrgrs
Posts: 20
Joined: Wed Nov 11, 2015 4:55 pm

Re: Different Conversation UI

Post by nrvllrgrs »

I cannot rename the button because it is created by the Dialogue System. For each PC response option, the system clones the template and adds it is an item to the response list. In your provided example, it lists all of the emails, [Logout], and Reply. Ideally, the logout and reply options should not be listed as emails, instead using predefined buttons.

Edit: I'm assuming the easiest solution is to prevent cloning a template if that option has a predefined button.
User avatar
Tony Li
Posts: 22106
Joined: Thu Jul 18, 2013 1:27 pm

Re: Different Conversation UI

Post by Tony Li »

Hi,

Using a predefined button work certainly work, as in the example.

Or download and import an advance copy of the updated Unity UI Support scripts that will be in the next release of the Dialogue System:

UnityUI_Support_2016-10-14.unitypackage

Response buttons cloned from the template are now renamed "Response: <your response text>" instead of "Response Button Template(Clone)".

Or, if you don't want to downnload and import the Unity UI Support scripts, create a C# script named "RemoveCloneFromName" containing this:

Code: Select all

using UnityEngine;

public class RemoveCloneFromName : MonoBehaviour {

    void Awake() {
        name = name.Replace("(Clone)", string.Empty);
    }
}
and add it to the template, or any GameObject really. It will remove "(Clone)" from the name if present.
nrvllrgrs
Posts: 20
Joined: Wed Nov 11, 2015 4:55 pm

Re: Different Conversation UI

Post by nrvllrgrs »

I could not figure out how to use Sequences to disable the buttons in the template list. However, I added an if-check around the template instantiation in to UnityUIResponseMenuControls (line 236) and it worked.

Code: Select all

// Instantiate buttons from template:
// Instantiate buttons from template:
for (int i = 0; i < responses.Length; i++) {
	if (responses[i].formattedText.position == FormattedText.NoAssignedPosition)
	{
		GameObject buttonGameObject = GameObject.Instantiate(buttonTemplate.gameObject) as GameObject;
		if (buttonGameObject == null)
		{
			Debug.LogError(string.Format("{0}: Couldn't instantiate response button template", DialogueDebug.Prefix));
		}
		else
		{
			...
		}
	}
}
User avatar
Tony Li
Posts: 22106
Joined: Thu Jul 18, 2013 1:27 pm

Re: Different Conversation UI

Post by Tony Li »

Great; glad you got it working.
Post Reply