This topic is valid only if you’re using "OnGUI bars:../components/renderer_types.html for rendering. You still can, but it’s highly recommended to switch to uGUI.

We’ve received numerous questions about why sometimes bars are not displaying after building, but it’s just fine in the editor. It seems like it’s a Unity bug, but there are cases when bars are not showing up on some hardware. If you’re experiencing the same, and you are using Deferred Lighting as your Rendering Path then you’re in the right place.

Origin

Deferred Lighting is a Rendering Path than can be set for Unity. You can read more about it here and check if your project is set with Deferred Lighting, open Edit → Project Settings → Player from the main menu.

Then locate Rendering Path setting. If it looks like below, then there’s no question about it, and it may cause EBT to be invisible sometimes.

Workaround

A situation described above can occur only when you’re using OnGUI renderers. To solve this (and many other issues) please consider switching to the newer Mesh renderers.

If you’re sure that you want to use OnGUI renderers, there’s nothing really that Energy Bar Toolkit can do about it, but there’s workaround:

An example will be presented on empty scene with default Main Camera object and simple bar with OnGUI renderer on it.

Create a new camera.

So you will have two of them.

And rename it to GUI Camera to better reflect the role of this object.

For this GUI Camera you have to set 4 things:

  1. Clear Flags to Depth only.
  2. Culling Mask to Nothing. OnGUI renderers aren’t using layers to render.
  3. Depth to 0. This must be greater than other’s camera Depth.
  4. Rendering Path to Forward.

This should be enough, but make sure that Main Camera settings are correct.

  1. Clear Flags usually should be Skybox or Solid Color.
  2. Culling Mask should have your 3D scene objects layers included.
  3. Depth must be lower than GUI Camera depth.
  4. Rendering Path must be set to Use Player Settings or Deferred Lighting.