Forum rules - please read before posting.

Little hiccup on first load of Unity UI

Hi Chris,

I'm using Unity UI for conversation lists and have noticed the following in my builds:

1. The first time the conversation panel is opened up there is a little jerky hiccup/delay

2. Subsequently the panel is much smoother

I don't see this in the editor, however - even when using a rather large game window.

Do you see similar behavior?

Comments

  • No.  Try seeing if you get the same effect with the defaut Conversation menu (not just the ConversationUI prefab, but the Menu entry listed in the Demo_MenuManager asset file).
  • Yes, your MenuManager and UI prefab does work as expected. But I'm not seeing anything significantly different between it and the UI prefab I'm using. I'm using a layout group on my panel directly, but otherwise the setup is the same.

    I must be missing something because I also notice that when trying "Unity Ui in scene" that it works in the editor - but the menu never appears in standalone builds. 

    Very odd...
  • I believe this had to do with fonts, actually. I originally had 3 different fonts in the menu, none of which had been used previous to the convo prefab being loaded the first time. Changing to the font already used in the scene cleared this up. 

    I'd still like to use the other fonts, so I'm wondering if there's a better way to pre-load or cache the additional fonts.

    I still wasn't able to get the Unity Ui in scene mode working in builds... but I wasn't planning on using that. 
  • I checked scene-based UIs recently and didn't find any problem - it may be just a workflow issue.

    If the problem is due to pre-caching fonts, then it'll be an issue with Unity rather than AC.  Perhaps you could preload them by having another UI with the same fonts display at the start of your game, only with an alpha value of zero.
  • Sorry for bumping such an old thread, but I thought I should highlight this is still a Unity issue in Nov 2023, and this thread was a life saver!

    I spent a long time today rewriting a script that resizes a scrolling TMPro speech bubble according to a non-scrolling dummy so that the initial size of the bubble is the same as the final one. This is a little complicated if you want to do it right because, if you just set a maximum width to the text object, the longest line won't necessarily be as wide as that width because of line breaks. So once the text is laid out on the dummy and you know the size TMPro is using, you need to check the width of the longest line and resize the text object again to exactly that width. Anyway, the point is that the script was a bit heavier than it should have been, and the hiccup dxmachina was talking about became really apparent.

    Optimising the script helped a bit, but it did not solve the hiccup issue altogether. I thought this was an issue with the way AC loaded menus, so I even tried running "AC.PlayerMenus.GetMenuWithName("Subtitles (Unity UI)").LoadUnityUI();" at the start of my game, but it did not help.

    What helped was Chris' suggestion above. I added a small TMPro object using the same font to the game's first scene, and the hiccup was completely gone. So I'm bumping this solution to keep it relevant and easily searchable.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.