Both panel name at start

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Wiik
Posts: 12
Joined: Mon Nov 01, 2021 3:52 pm

Both panel name at start

Post by Wiik »

Hi,
i have 2 Subtitles panels with Visibility= always from start
And their name should be disabled at start with > On Open() GameObject.SetActive = false

my issue is at the start of the conversation, both of their name are showing.

Any idea why ?
Wiik
Posts: 12
Joined: Mon Nov 01, 2021 3:52 pm

Re: Both panel name at start

Post by Wiik »

up
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Both panel name at start

Post by Tony Li »

Hi,

Thanks for the "up." I'm sorry; I don't know how your message slipped by. Add this script to your subtitle panel(s):

HideNameOnOpen.cs

Code: Select all

using System.Collections;
using PixelCrushers.DialogueSystem;
using UnityEngine;

public class HideNameOnOpen : MonoBehaviour
{
    private void OnEnable()
    {
        StartCoroutine(HideNameAtEndOfFrame());
    }

    IEnumerator HideNameAtEndOfFrame()
    {
        yield return new WaitForEndOfFrame();
        var panel = GetComponent<StandardUISubtitlePanel>();
        panel.portraitName.gameObject.SetActive(false);
    }
}
Wiik
Posts: 12
Joined: Mon Nov 01, 2021 3:52 pm

Re: Both panel name at start

Post by Wiik »

Thank Tony, that worked.
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Both panel name at start

Post by Tony Li »

Glad to help!
Post Reply