Layers are a type of object which can be used to control the order in which visible objects in FlatRedBall are drawn. Most objects sort by their Z value. In other words, objects which are further from the Camera will draw behind objects which are closer to the Camera. Layers allow control over draw order without changing the Z of objects. Layers are often used to draw certain categories of objects. For example, you may have regular game objects (such as trees, the ground, the sky), a Layer specifically for HUD elements (score, health, ammo), and another Layer for popup screens (pause screen, disconnected controller screen).

Layers are also often used to draw things in 2D coordinates on top of a 3D Camera.

For a general tutorial on Layers in Glue, see the Using Layers Glue Tutorial page.

For information on using Layers in code, see the Layer page.

Creating a Layer in Glue

To create a Layer in Glue:

  1. Select a Screen or Entity which will contain the Layer
  2. Right click on that Screen or Entity’s “Objects” item
  3. Select “Add Object”
  4. Select “FlatRedBall or Custom Type”
  5. Select “Layer”
  6. Click OK


Layer Order

Layers are drawn in the same order that they are added in code. In other words, if Layer1 was added first, then Layer2, Layer1 would draw first, then Layer2 would be drawn on top of Layer1.

Similarly, the order of Layers in Glue impacts the order that they are drawn. Layers draw top-to-bottom. Therefore, the first layer when looking at the list of elements in Glue will be drawn first, and any subsequent Layers will be drawn on top.


You can adjust the order of layers by right-clicking on a Layer and selecting one of the options to move it:


Additional Information

  • Is2D – Property controlling whether the layer is 2D.