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
0
Question by J0maikke · Aug 20, 2013 at 12:13 PM · multiplayerscrollviewchat

Chat: new messages, bottom of scrollview?

Hello,

I've followed the multiplayer tutorials from GTGD, and I want to change the chat. In some multiplayer games, the new message from other players come under the old messages. But in that tutorial the new messages will come above it (I hope you understand what I mean xD).

Is there mayby an solution so I can calculate the minimum of the scrollPosition, and set the scrollPosition (Y) to that value? I don't know what part of the script you need (it is big..), but a example with the solution is also good.

 scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(windowWidth - padding), GUILayout.Height(windowHeight - padding - 5));
 
 GUILayout.Label(communication, myStyle);
 
 GUILayout.EndScrollView();


Thanks, Jomaikke

Comment
Add comment
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

2 Replies

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

Answer by Coersum · Feb 19, 2014 at 07:39 PM

I know it's an old question but I just went through the GTGD tutorial too and wanted more out of the chat so if anyone else lands here, you will know.

For what you want (newest messages being at the bottom of the chat), in the CommunicationWindow script, you need to change the RPC SendMessageToEveryone from

 communication = pName + " : " + message + "\n" + "\n" + communication;

to

 communication = communication + pName + " : " + message + "\n";

I removed one "\\n" because there is no need for it and a waste of space imo.

Comment
Add comment · Show 3 · 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 J0maikke · Feb 20, 2014 at 08:55 AM 0
Share

Hmm... I don't have the project anymore, but it seems to be the answer. I didn't know it was so simple xD

avatar image KuPAfoo · Feb 21, 2014 at 02:03 AM 0
Share

Thanks for the reply, I haven't tested this yet, but yes... that does look exactly right lol. All the way down to the double \n's... that was another issue I didn't pick up.

thanks!

avatar image Coersum · Feb 21, 2014 at 02:08 AM 0
Share

You also might want to add the following code in the TellEveryone... RPC functions at the bottom of the script (right under the line I posted in my post above) so that the scrollbar follows the chat.

 scrollPosition.y = $$anonymous$$athf.Infinity;

What will happen is when someone types something, the scrollbar will go all the way down to the last message, you can still scroll up in between messages (kind of a fix).

avatar image
0

Answer by KuPAfoo · Aug 28, 2013 at 05:00 AM

Are you using photons PUN?

I have the same question xD

tinkering with some things while i wait for a reply

In fact, here's my thread: http://answers.unity3d.com/questions/525380/chat-order.html

Comment
Add comment · 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

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

17 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

Related Questions

Voice chat in browser based unity projects 3 Answers

Multiplayer Voice Chat? 2 Answers

ScrollView performances with huge number of GUIContents. 2 Answers

Unity networking tutorial? 6 Answers

Global Chat between different servers 0 Answers


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