Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Need assistance creating a chatbox with Unity UI

Discussion in 'Scripting' started by JoshMBeyer, Jan 22, 2015.

  1. JoshMBeyer

    JoshMBeyer

    Joined:
    Aug 20, 2012
    Posts:
    48
    I made the chat box, and a prefab that is a panel, image, and text. The image will be the user's avatar, and the text will of course be what the user types and sends. I already have the instantiate down but the issues are that the messageObject (Prefab) will stack ontop of eachother instead of moving up the chatbox as u would expect it too. I know this is because I haven't coded it to do so, and that is one of the things I need help with. How would I do this?

    Make the messageObject(Prefab) move up the chatbox as the users hit send

    make the panel size scale with the length of the text the user sent.

    And using RPC I assume to display them across the network
     

    Attached Files:

  2. cmcpasserby

    cmcpasserby

    Joined:
    Jul 18, 2014
    Posts:
    315
    Why not use the horizontal layout group and out your objects that contain previous messages in that?

    This way it will auto space then out
     
  3. JoshMBeyer

    JoshMBeyer

    Joined:
    Aug 20, 2012
    Posts:
    48
    I added the layoutgroup but the parameters aren't really cusomizable besides spacing and padding, so when i send messages, they just shrink as more come in not moving up the chatbox
     
    Last edited: Jan 22, 2015