Search Unity

Talk Bubbles with the new GUI system

Discussion in 'Immediate Mode GUI (IMGUI)' started by manuelflara, Nov 27, 2007.

  1. manuelflara

    manuelflara

    Joined:
    Jan 21, 2007
    Posts:
    87
    Hi all,

    For my current project I need some talk bubbles appearing on the screen so I thought I would give the new system a try. At first I thought I would need to create 9 boxes -one for each "sector" of the TalkBubble imge, which let's say it is tileable in its sides and center, but its borders have to stay.

    However, to my surprise I was able to get pretty far with a single box. Word wrap, image borders and I'm quite close! Look at the attached picture. As you can see I still have some weirdness going on on the tiling parts of the image. Do you know if there's any way I could fix this so I could use a single GUI.Box call to render my Talk Bubbles?

    Best regards :)
     

    Attached Files:

  2. shaun

    shaun

    Joined:
    Mar 23, 2007
    Posts:
    728
    It looks like you just need to tweak the Border setting for the GUISkin.Box element. You may want to move the protruding arrow to the right a bit more to capture it in the non-tiling area - otherwise the minimum size of your speech bubbles will be limited.

    If you have ExecuteInEditMode enabled, you can see the changes as you enter then + if you put a GUILayout.TextArea in the bubble, you can type to see how it resizes ;)

    Hope this helps.
    Shaun
     
  3. NicholasFrancis

    NicholasFrancis

    Joined:
    Apr 8, 2005
    Posts:
    1,587
    Also, try turning mipmapping off for your speech bubble texture. If you have a large speech bubble image, mipmapping can cause a lower level mip to be picked when the sides get scaled down.
     
  4. manuelflara

    manuelflara

    Joined:
    Jan 21, 2007
    Posts:
    87
    Turning mipmapping off did it, thanks!
     
  5. podperson

    podperson

    Joined:
    Jun 6, 2006
    Posts:
    1,371
    My problem is I'd prefer to have the little pointer part of the speech balloon near the middle of the top/bottom ... which isn't quite so doable.
     
  6. shaun

    shaun

    Joined:
    Mar 23, 2007
    Posts:
    728
    You could do that with a compound control tha centers a new GUI element (the arrow) at the bottom of the speech bubble.
    I use a similar technique for creating the size controls (X [] _ ) in the top right of my windows.
    Just avoid semi-transparency (apart from the edges), since you want to overlay the arrow to line up with the bubbles edges.