# Accessing Gum Screens in Code

### Introduction

Gum screens which are part of a FlatRedBall project generate a custom class. This custom class provides access to all contained objects within the screen. While it is possible to also interact with the elements in a general way (by name), using the typed properties in a screen is usually safer and more convenient.

### Initial Setup

To write code against a Gum screen, you must first have:

* A Glue project
* A Gum project inside the Glue project
* A Glue screen (we'll call it GameScreen)
* A Gum screen (we'll call it GameScreenGum)
* The Gum screen file referenced by the Glue screen

Note: Once you add a Gum project to your Glue project, Glue will automatically add new Gum screens for each Glue screen. This functionality can be controlled by selecting the .gumx file in Glue:

![](/files/YcAwLVfSoHYTX0uURsif)

If you have already created Glue screens and Gum screens, but the two are not associated, you can right-click on the Files of any Screen to add an existing Gum screen: ![](/files/OyEITyw83bkaM5O42LH8) Regardless of which method is used, the result is a Gum screen that is using a specific, generated class, as can be seen in Glue:

![](/files/FJao2rIDzmetEv5To1xP)

### Accessing Objects in Code

The Gum screen object can be accessed in code just like any other object. All contained objects in a Gum screen are accessible through properties on the Gum screen. For example, consider the following Gum screen:

![](/files/2iy7dkCFk6vD4V6zQRz0)

These can be accessed in code using the names of the objects from Gum:

![](/files/SDntzMMzJn3EDXGqI9ih)

###


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flatredball.com/flatredball/gum/how-to-work-with-screens-in-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
