- Home /
Question by
aanimation · Jan 29, 2015 at 02:15 PM ·
inverse
GUILayout.BeginScrollView inverse text added
hi All,
im using GUILayout.BeginScrollView to show 'textchat strings'. actually while add new text then the texts will show in top than old. how to reverse actually text from bottom to top?
Comment
How are you iterating over the strings? Could you show us some simplified code or the code you are currently using. If you are iterating over a collection of strings, can you just iterate from Length+1 back to 0?
@Chris_Dlala, codes are
List<string> users = new List<string>{"usergame1","usergame2","usergame3","usergame4","usergame5","usergame6","usergame7"};
GUILayout.Label("User List :", GUILayout.Width(60));
scrollPos = GUILayout.BeginScrollView(scrollPos,GUILayout.Width(Screen.width/4));
for ( int i = users.Count - 1; i >= 0; i-- )
{
GUILayout.Label(users[i]);
}
this is only simple code, im using it too in chat system string, how to make it inverse sort? new string will add from bottom to top.
Answer by aanimation · Jan 30, 2015 at 10:25 AM
find little solutoin as : foreach(string words in messages) { GUILayout.Label(words); }