Overriding Dialogue UI and render modes for a single scene?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
alexlol
Posts: 35
Joined: Sat Nov 07, 2020 8:20 am

Overriding Dialogue UI and render modes for a single scene?

Post by alexlol »

Hi,

I have a single scene that uses a different Dialogue UI (an SMS conversation) to the rest of my scenes (basic overhead bubbles).

I'd like to be able to apply some of Unity's post processing and vcam camera effects (i.e a screen shake and some bloom) to the SMS dialogue UI, so I'm setting the render mode to World Space.

This works, but I'm using a Dialogue UI prefab with a default Screen Space Overlay which instantiates in the menu and persists, I'd like to make sure the UI is changed from its default Screen Space to a temporary World Space for the SMS scene, then changed back for the next scene.

The best way I can think to do this is just to have a check on my Game Manager script to get the camera and canvas on scene load and assign everything that way, but I wanted to make sure I wasn't missing something. Is there a more graceful way of temporarily overriding both the Dialogue UI and its render mode already built into Dialogue System? Thanks,

- A
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Overriding Dialogue UI and render modes for a single scene?

Post by Tony Li »

Hi,

You could add a script to that scene that assigns the SMS dialogue UI. Example:

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;
public class UseDialogueUIForScene : MonoBehaviour
{
    public GameObject sceneSpecificDialogueUI; //<--ASSIGN IN INSPECTOR.
    private IDialogueUI previousDialogueUI;
    void Start()
    {
        previousDialogueUI = DialogueManager.dialogueUI;
        DialogueManager.UseDialogueUI(sceneSpecificDialogueUI);
    }
    void OnDestroy()
    {
        DialogueManager.dialogueUI = previousDialogueUI;
    }
}
alexlol
Posts: 35
Joined: Sat Nov 07, 2020 8:20 am

Re: Overriding Dialogue UI and render modes for a single scene?

Post by alexlol »

Thanks, I thought it might be something like that!

For anyone else coming across this post with the same issue - when I switch the render mode to World Space, I need to switch it first to Screen Space- Camera in the line above. This sets the correct scale and position of the canvas first (I don't know why it needs to be done that way but it works!).
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Overriding Dialogue UI and render modes for a single scene?

Post by Tony Li »

Oh, I assumed the scene-specific world space UI would already be in its own canvas, and you wouldn't need to change any other canvas's settings. Anyway, sounds like you have it working.
Post Reply