Render the dialogue box on top of a 3D gameObject

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Rossakis
Posts: 2
Joined: Fri Jun 16, 2023 1:06 pm

Render the dialogue box on top of a 3D gameObject

Post by Rossakis »

Hi! I'm a recent user of the Dialogue System and wondered whether it was possible to render the dialogue canvas on a 3D game object in the scene (a notebook in this instance), that can be moved around the scene with animations and whatnot.

I know since the canvas is UI it doesn't work that way, but I was curious if there is a way to work around it or something.
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: Render the dialogue box on top of a 3D gameObject

Post by Tony Li »

Hi,

Yes -- in fact, this is what the computer terminal in DemoScene1 does. It has a dialogue UI in a world space canvas. That world space canvas is positioned on top of the computer monitor GameObject.

To do this, add a world space canvas to your notebook. Add a dialogue UI to it. Then, assuming the notebook GameObject will be the conversation actor or conversation conversant, add an Override Dialogue UI component and assign the dialogue UI.
Rossakis
Posts: 2
Joined: Fri Jun 16, 2023 1:06 pm

Re: Render the dialogue box on top of a 3D gameObject

Post by Rossakis »

Thank you for your help! It worked, and currently, my dialogue menu is projected onto a canvas resembling a notebook.

However, I came across a problem where the NPC's response panels are also being shown on this World Space Canvas, which I'd like to remain as a regular Overlay Canvas, so that their subtitles appear correctly on the screen, regardless of the player's position.

I thought of keeping two Canvases, a World Space one and one for Overlay, and through scripts, I'd be changing the canvases in Dialogue System Controller from one to another, depending on whether or not the NPC is currently talking.

However, I couldn't find any methods or variables in the DialogueSystemController class to replace the current Canvas at runtime, or maybe there is a better way to implement my idea?
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: Render the dialogue box on top of a 3D gameObject

Post by Tony Li »

You can just put them in separate canvases -- no need for extra scripting.
Post Reply