- Home /
Question by
karthees · Dec 31, 2013 at 12:03 PM ·
scrollviewguilayoutgui.label
How to make scroll GUILayout.label
I have big content for display using GUILayout.label. I need to add scroll for my content.
GUI.skin.label = style;
GUILayout.Label("The tiger is the biggest species of the cat family\n\nTigers can reach a length of up to 3.3 metres (11 feet) and weigh as much as 300 kilograms\n\nA group of tigers is known as an ‘ambush’ or ‘streak'\n\nTigers are good swimmers and can swim up to 6 kilometres\n\nTigers usually hunt alone at night time\n\nTigers can easily jump over 5 metres in length\n\n ", style);
Comment
Best Answer
Answer by Bunny83 · Dec 31, 2013 at 12:06 PM
Just wrap it in a scrollview:
// C#
Vector2 scrollPos;
void OnGUI()
{
GUI.skin.label = style;
scrollPos = GUILayout.BeginScrollView(scrollPos);
GUILayout.Label("The tiger is the biggest species of the cat family\n\nTigers can reach a length of up to 3.3 metres (11 feet) and weigh as much as 300 kilograms\n\nA group of tigers is known as an ‘ambush’ or ‘streak'\n\nTigers are good swimmers and can swim up to 6 kilometres\n\nTigers usually hunt alone at night time\n\nTigers can easily jump over 5 metres in length\n\n ", style);
GUILayout.EndScrollView();
}
I have new line character. So, it displays one by one. I need to scroll vertical. Your code is scrolling horizontal. How can i do?
Your answer
![](https://koobas.hobune.stream/wayback/20220613125225im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to hide scrollbar on side of the view 0 Answers
how to accomplish:"When click a button , four button occour ." 0 Answers
How to change thickness of ScrollBar of GUILayout ScrollView? 0 Answers
GUILayout.BeginScrollView cant seem to change where the box I create is positoned. 1 Answer
How do you use EditorGUILayout.TextArea with EditorGUILayout.ScrollViewScope? 1 Answer