Hi Tony! i found a little issue when i use this two component in my speech bubble system, the idea of use this, is to fit the size of the bubble by the amount of text the npc will say to the player.
some times at the start of the scene when the dialogue initalice it seem that the panel is disabled before the vertical Layout Group get the values correctly and the content size set to 0 all children, if i disabled the CSUIBubble (my custom AbstractDialogueUI) and try starting 10 times and all goes fine but if i enabled at the seconds goes wrong and set sizes to cero.
who start disabling gameobject in the dialogueManager? and can i wait one frame to let the component get propertly the values?
thanks for all
Unity UI Vertical Layout Group & Content Size Fitter
Re: Unity UI Vertical Layout Group & Content Size Fitter
Hi Alfonso,
What about adding a script to the dialogue panel that has an OnEnable method? When the dialogue panel is enabled, you can recompute the layout.
Otherwise, you could override AbstractDialogueUI.Start. The base method hides everything:
You could create a subclass like this:
What about adding a script to the dialogue panel that has an OnEnable method? When the dialogue panel is enabled, you can recompute the layout.
Otherwise, you could override AbstractDialogueUI.Start. The base method hides everything:
Code: Select all
/// <summary>
/// Starts this instance by hiding everything. The only exception is if an alert message is
/// already showing; it keeps this message visible.
/// </summary>
public virtual void Start() {
if ((UIRoot == null) || (Dialogue == null) || (QTEs == null) || (Alert == null)) {
enabled = false;
} else {
UIRoot.Show();
Dialogue.Hide();
QTEs.Hide();
if (!Alert.IsVisible) Alert.Hide();
if (IsOpen) Open();
if (!(Alert.IsVisible || IsOpen)) UIRoot.Hide();
}
}
Code: Select all
public override void Start() {
StartCoroutine(WaitToStart());
}
private IEnumerator WaitToStart() {
yield return null; // Wait 1 frame first.
base.Start();
}
Re: Unity UI Vertical Layout Group & Content Size Fitter
as I imagined a frame waiting fixes everything
great as always tony
great as always tony