Inserting image in dialogue

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Nervalor
Posts: 2
Joined: Tue Mar 22, 2016 6:53 am

Inserting image in dialogue

Post by Nervalor »

Hi !
We are currently working on a "choose your own adventure" kind of game, and would like to insert images in the dialogues as they change.
It is our first real Untiy project, and we are not sure what to do yet.

We would like to display an illustration on the screen appearing, disappearing and changing following the player's choices.
Basically, if I click the "B" text box, conversation evolves on the "B" path, and the correct illustration is shown.

Is it possible to manage this through the dialogue system ? Or is it possible to connect the dialogue system to Unity directly so it reacts to the choices in the dialogue ?

Thanks in advance for your help, we really need you ! :ugeek:

Unity 5.3.3f1
Dialogue System 1.6.0.1
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Inserting image in dialogue

Post by Tony Li »

Hi,

Yes, there are many ways to do this in the Dialogue System. BTW, the Dialogue System Extras page has a free Choose Your Own Adventure framework that you can use to give yourselves an extra head start, or just to pick apart for ideas.

There are two ways to insert images in dialogues: (1) as images shown somewhere on the screen such as a background image, or (2) inline with the dialogue text.

Inline with dialogue text: The text rendering components in Unity's built-in GUI systems (Unity UI and the older, legacy Unity GUI) don't natively support inline images. However, if you buy Text Mesh Pro, which supports inline images, the Dialogue System includes a support package.

Images on screen: The easiest solution is to set up each image in your scene as a separate GameObject with a unique name. They could be sprites, Unity UI Images, or whatever you prefer. Deactivate all of these GameObjects. As you write your conversation, use sequences to activate and deactivate GameObjects as appropriate. Specifically, in the Sequence field of dialogue entries use the SetActive() sequencer command. For example, say you've set up two GameObjects with background images: "Cottage Background" and "Forest Background". In the dialogue entry where the player travels from the cottage to the forest, set the Sequence field to:

Code: Select all

SetActive(Cottage Background, false);
SetActive(Forest Background, true)
If you want to use some other method and you have a programmer on your team, you can also write your own custom sequencer commands or add your C# code to the Lua environment. The process is actually quite simple and doesn't require any advanced programming skills.

If I can provide more help with any of this, just let me know!
Nervalor
Posts: 2
Joined: Tue Mar 22, 2016 6:53 am

Re: Inserting image in dialogue

Post by Nervalor »

We used the "Images on screen" solution, it works ! Thank you :D
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Inserting image in dialogue

Post by Tony Li »

Happy to help! Have fun making your CYOA!
Post Reply