How does ScrollView automatically add user elements to the Content Container?

Hi there!

Been trying to figure out how ScrollView manages to push a user added element to the content container like in the gif, i feel like i’m missing something. I’ve been scanning the source code but i just can’t figure it out.

If anyone could guide me to the answer i be greatful!

f4bf1c146f6eb7011c315694020f08eb

contentContainer is virtual, you can override it and provide a custom VisualElement to use instead, this is what the ScrollView does:

private VisualElement m_ContentContainer;

public override VisualElement contentContainer
{
    get { return m_ContentContainer; }
}
1 Like

Thank you!

It’s annoying it’s when it’s so simple you just cannot see it haha.

1 Like