Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Text boxes like in chat apps

Discussion in 'Immediate Mode GUI (IMGUI)' started by Corva-Nocta, Dec 6, 2022.

  1. Corva-Nocta


    Feb 7, 2013
    Hey all, working on a game where I need the dialogue to be visually in the form of text chats, and having a bit more trouble than I expected. (Also hoping this is the correct place to post this!) I've got a scrollable window and I can instantiate dialogue and everything just fine so far, I'm just having a hard time making it look good, or even something resembling a chat app lol.

    The current setup is a scrollable window panel with a vertical layout component. I can spawn message objects, like an image or a new panel or whatever, but I can't get them to resize based on text length. I thought perhaps a content size fitter component would do the trick, but it doesn't seem to do anything at all. I suspect the vertical layout settings are overriding the content size fitter.

    Anyway I'm not really sure how to tackle this, and I'm not having a lot of luck with google/youtube. I think I might just be using the wrong search terms? If anyone knows a tutorial video that shows how to set this up that would be great!

    If anyone has ever made a system like this before, can you offer any insight on how you get the message boxes to resize based on the text within them?

    Any help at all would be greatly appreciated!