Disable invector UI

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
hrohibil
Posts: 368
Joined: Thu Nov 04, 2021 12:50 pm

Disable invector UI

Post by hrohibil »

Hello

Quick question-

I use Invector-
The invector UI is always in front-
How do disable it during convsations?
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Disable invector UI

Post by Tony Li »

Invector has several UI canvases.

The easiest solution is to set the Dialogue Manager's Canvas > Sort Order to a higher value such as 2. This will put the UI on top of the Invector UIs, whose canvases use Sort Order 0.

If you don't want to do that, you can write a script that disables Invector's canvases during conversations. Something like:

Code: Select all

public class DisableInvectorUIDuringConversations : MonoBehaviour // Add to Dialogue Manager.
{
    void OnConversationStart(Transform actor)
    {
        SetInvectorCanvases(false);
    }
    void OnConversationEnd(Transform actor)
    {
        SetInvectorCanvases(true);
    }
    void SetInvectorCanvases(bool value)
    {
        if (vHUDController.instance != null) vHUDController.instance.GetComponentInParent<Canvas>().enabled = value;
        if (vControllerAimCanvas.instance != null) vControllerAimCanvas.instance.canvas.enabled = value;
        if (FindObjectOfType<vThrowManager>() != null) FindObjectOfType<vThrowManager>().GetComponentInChildren<Canvas>().enabled = value;
    }
}
hrohibil
Posts: 368
Joined: Thu Nov 04, 2021 12:50 pm

Re: Disable invector UI

Post by hrohibil »

Thank you Toni

First suggestion was easy and spot on
Embarrassed I missed that one.
Sorry…
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Disable invector UI

Post by Tony Li »

Glad to help!
Post Reply