Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by JoshMBeyer · Jan 23, 2015 at 01:51 PM · c#uisystemchatunityui

How to have both, a scroll view AND vertical Layout?

I am trying to make a chat box, haven't really had much help... Only thing that was recommended was to use a vertical layout group. However, I used that and now my scroll view doesn't work. I just need help getting a chatbox working with UnityUI. I can handle the network side. I have a Panel_Chatbox, with a mask and scrollRect. I have a prefab "messageObject" consisting of a Panel, Image, and Text. Think of facebook's messenger. It's going to be similar to that, a box containing the content, a user avatar, and the text. So when the user types in the input field and hits send, that text will be the "messageToSend" of the instantiated messageObject, their avatar will be the Image, and so on. So at this point, when I hit send, the messages stack ontop of each other. I need them to remain the same width and height, but go up the parent panel, as more messageObject's come in. Then the user can use the scroll view to go up and read previous messages. I've reached out on this several times cause I am completely stuck, but not really any responses, or someone telling me how to visually design the chat box. I just need to get it to work properly. I tried the vertical layout group angle but that fails as the content autoscales to the panel depending on the amount of messageObjects eventually getting tiny, and they don't move up the list.. I tried playing around with settings but no luck. I would just greatly appreciate someone helping me though creating this part

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Fornoreason1000 · Jan 23, 2015 at 01:53 PM 0
Share

can you upload a picture or something of what you chat box to look like and what it looks like now?

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Mmmpies · Jan 23, 2015 at 02:05 PM

Try this, it's based on a @BoredMormon tutorial but just fills a scroll panel with a load of rubbish text, should get you most of the way there.

Links to the tutorial are in the document.

ScrollPanel

EDIT:

Looking at that video you've deffinately got your pivot point in the wrong place as that's exactly what happens when you leave the pivot in the center. If you got through that document and the related Richard Gubb tutorial it show you how to move the pivot. I suspect to force it to show the bottom one you'll need to set that VerticalNormalizedPosition like I said.

I'll be able to check when I get to a PC with Unity though, should be in a couple of hours.

Nice design BTW.

EDIT 2:

OK the content of the button probably need a content size filter rather than a fixed size with, set the mimimum size and also add a contentSizeFilter to expand should the text increase. You probably want to switch off the best fit part of the text for that to work and just stick with a font size of your choice.

Difficult to work out without Unity around to cheeck the values but we'll get it sorted don't worry.

EDIT 3

OK on the scroll panel where I assume you now have the pivot at the bottom change the Content Size Filter to Vertical Fit = Preferred Size. That works for my simple text display but you may need additional scripts on you panel as it's more complex.


how-to-make-a-scrollable-panel-using-the-46-unity.pdf (515.6 kB)
Comment
Add comment · Show 7 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image JoshMBeyer · Jan 23, 2015 at 03:02 PM 0
Share

well i have it pretty much finished, the only issues is they are auto scaling as more messages come in to the chatbox, shrinking in size

avatar image Mmmpies · Jan 23, 2015 at 03:06 PM 0
Share

Can you show an image so I know what you mean?

avatar image JoshMBeyer · Jan 23, 2015 at 03:11 PM 0
Share
  1. I need the scroll view to automaticly be at the bottom when new text is entered, cause right now its staying center and after you type you have to scroll down to see it.

  2. $$anonymous$$ake it to where the user can type out a paragraph rather than just a few characters...

  3. $$anonymous$$ake it to where the Panel size will scale larger to fit the users text inside of it.

  4. Fix the issue where if I type more than lets say 5 words, the input field will let me, but when i hit send, it only sends the last 5 words that are currently showing in the input field... the rest doesn't send

But regardless of the searching I can't find the answers

avatar image Mmmpies · Jan 23, 2015 at 03:23 PM 1
Share

You could do the opposite of what the document says and set the pivot of the parent panel to the bottom but I don't have Unity available to me at the moment so I'm not sure if that will add the new messages above it.

Other than that try setting the VerticalNormalizedPosition of the scrollRect to 0, but hey that's from memory so may not be the right way round.

Just create a public ScrollRect $$anonymous$$yScrollRect to access that VerticalNormalizedPosition value.

Sorry for any typos, like I said no access to Unity AT$$anonymous$$.

avatar image JoshMBeyer · Jan 23, 2015 at 03:24 PM 0
Share

One sec ill post a video

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

21 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Illuminating a 3D object's edges OnMouseOver (script in c#)? 1 Answer

Name/Screen Name Input 0 Answers

ExpManagement problems 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges