Unity UI - Scroll Menu Pt 4: Text Log - A scrolling, vertical list of text items.

preview_player
Показать описание
A Unity UI tutorial series covering how to build menus and lists of UI objects that can be scrolled using the mouse, touch or a scrollbar.

This video, # 4 in the series, shows how to build a 'text log' style UI object, a list of text items that the player can scroll through that get logged when called by script. This video covers the layout and the scripting.

A basic understanding of the Unity UI system is assumed.

Or check out my projects on Unity Connect:
Рекомендации по теме
Комментарии
Автор

Thanks for the tutorial! I have one question:
How do I let the text start at the top and go to the bottem with the newest one staying at the top instead of being at the bottem? @5:36

Thanks!

maartenpc
Автор

Now that I've finished it and have it all working, thank you very much.

My favorite part was when you noticed that there were some bits of text at the top and suggested that you could put a menu over that to hide it haha

kryllion
Автор

Thank you very much. I had some quirky behaviour until I found out your implementation :)

konradborowiecki
Автор

This is very helpful, but I wish I knew how to zoom in on a video, because your font is very small, and most of what I see when you are writing code is the 80% of your screen that is unused, and very, very small text on the left side. If you weren't also reading it out loud, I'm not sure I could keep up.

kryllion
Автор

Hey! Many thx for this great Vid! I was just wondering why it's impossible to set ScrollBar Inactive? I wanted to have it activated only when items are overpopulating the panel.

MiladEkramnia
Автор

This video helped me a lot! I have one problem though that I thought you may be able to help me solve: after I destroy a text object and spawn another one, it leaves a blank space where the previous object was. How do I make it spawn on empty space?

Radixos
Автор

Hi! I just followed your guide and at 5:43 ... how to make old text object hide under the image?

wlcharlie
Автор

Great tutorial !
For an easier development, I think the TextLogControl should be a Singleton, to be able to access it for any script.
Thank you for your time

Genkis
Автор

Thanks for the tutorial! I have one question:
Is there a way to resize the text item depending of the text length ? Like if one of the log has several line it would display accordingly
Thanks

hypno
Автор

Thanks!!!
--
NullReferenceException: Object reference not set to an instance of an object
TextLogControl.LogText (System.String newTextString, UnityEngine.Color newColor)
--
Would You Know How to Fix This?

PhoenixFighter
Автор

Question pls,
I can't make the items fit the screen, the items anchor doesn't move,
how did you fixed it pls.

neckudart
Автор

If you want to use this on newer Text TextMeshPro:
In the TextLogItem script:
Type this to the top: using TMPro;
And then replace GetComponent<Text> with: GetComponent<TMP_Text>()

Final should like this:
using TMPro;

public class TextLogItem : MonoBehaviour
{
public void SetText (string myText, Color myColour)
{
GetComponent<TMP_Text>().text = myText;

= myColour;
}

}

wmetz