Accessing Gum Screens in Code


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:

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:

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

Last updated