Page 1 of 1

Disable invector UI

Posted: Sat Feb 26, 2022 6:20 pm
by hrohibil
Hello

Quick question-

I use Invector-
The invector UI is always in front-
How do disable it during convsations?

Re: Disable invector UI

Posted: Sat Feb 26, 2022 7:33 pm
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;
    }
}

Re: Disable invector UI

Posted: Sat Feb 26, 2022 7:36 pm
by hrohibil
Thank you Toni

First suggestion was easy and spot on
Embarrassed I missed that one.
Sorry…

Re: Disable invector UI

Posted: Sat Feb 26, 2022 7:37 pm
by Tony Li
Glad to help!