your first panel

create the simplest possible UI in goo

by the end of this guide, you will have text in a container that says Hello World

the code

create Code/Demo/HelloWorldUI.cs:

using Goo;
using Sandbox.UI;

namespace Sandbox;

public class HelloWorldUI : GooPanel<Text>
{
    protected override Text Build() => new Text("Hello");
}

add it to a scene

  1. open the s&box editor to your preferred project and scene
  2. create an empty GameObject in the hierarchy
  3. add component → ScreenPanel or WorldPanel
  4. add component → UI Panels → HelloWorldUI

press play

if you did this correctly, you should see floating black text that says "Hello"

small black "Hello" rendered in the s&box editor

the text will be tiny and unstyled

make it nice

a small addition to the hello world example to make it look nicer:

using Goo;
using Sandbox.UI;

namespace Sandbox;

public class HelloWorldUI : GooPanel<Container>
{
    protected override Container Build() => new Container
    {
        Padding = 24,
        BackgroundColor = Color.White,
        BorderRadius = 12,
        Children = { new Text("Hello World") },
    };
}

if you did this correctly, you should see a card container with a white background and the words "Hello World" inside of the container

white rounded card containing "Hello World"

congratulations. you're goo-ey now. all style properties exist in this same format