Hi there,
I am currently customizing the response panel now and facing a bit of a problem.
So the response panel contains of button that fits the size of the text (so no max or min width / height)
In the editor, the spacing works well: it means if I duplicate the button several time and change the text inside, the space between button is the same.
But in the runtime I face the problem that the button has no space at all. And if I update the child alignment, then the spacing is correct. See the following gif: I even changed back to the original child alignment and the spacing is still correct.
ResponsePanel Spacing Problem/Bug?
Re: ResponsePanel Spacing Problem/Bug?
Hi,
There shouldn't be any difference in UI between editor and build, other than a different game view resolution. Test different Game view sizes to make sure the resolution isn't the issue. Keep in mind that when you play a build, it plays from the first scene in build settings. Make sure that scene, or whichever scene has the first instance of the Dialogue Manager GameObject, points to the right dialogue UI and not an older version.
There shouldn't be any difference in UI between editor and build, other than a different game view resolution. Test different Game view sizes to make sure the resolution isn't the issue. Keep in mind that when you play a build, it plays from the first scene in build settings. Make sure that scene, or whichever scene has the first instance of the Dialogue Manager GameObject, points to the right dialogue UI and not an older version.
-
- Posts: 9
- Joined: Sat Dec 12, 2020 11:56 am
Re: ResponsePanel Spacing Problem/Bug?
Just did a little digging. I am not the only one who has this problem. Probably not Dialoge Systems related. Since it has something to do with content size fitter that needs to be force updated
-
- Posts: 9
- Joined: Sat Dec 12, 2020 11:56 am
Re: ResponsePanel Spacing Problem/Bug?
So I created a script called ForceRebuildUI and add them to the ResponsePanel.
I have to put it in Update since it doesn't work inside OnEnable or Start. Do you think this is memory expensive? Or do you have better solution for me?
Thanks.
Code: Select all
public class ForceRebuildUI : MonoBehaviour
{
//Mark the given RectTransform as needing it's layout to be recalculated during the next layout pass.
public RectTransform rect;
private void Update()
{
LayoutRebuilder.MarkLayoutForRebuild(rect);
}
}
Thanks.
Re: ResponsePanel Spacing Problem/Bug?
Hi,
That's going to affect performance. Try adding a script like this to the Dialogue Manager instead:
RebuildDialogueUI.cs
It will only issue the rebuild once when setting up each menu.
That's going to affect performance. Try adding a script like this to the Dialogue Manager instead:
RebuildDialogueUI.cs
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class RebuildDialogueUI : MonoBehaviour
{
void OnConversationResponseMenu(Response[] responses)
{
var rect = ((DialogueManager.dialogueUI as StandardDialogueUI).conversationUIElements.defaultMenuPanel.panel.GetComponent<RectTransform>())
LayoutRebuilder.MarkLayoutForRebuild(rect);
}
}
-
- Posts: 9
- Joined: Sat Dec 12, 2020 11:56 am
Re: ResponsePanel Spacing Problem/Bug?
Thanks. It works as well!
Re: ResponsePanel Spacing Problem/Bug?
Glad to help!