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.
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.
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:
- Clear Flags to Depth only.
- Culling Mask to Nothing. OnGUI renderers aren’t using layers to render.
- Depth to 0. This must be greater than other’s camera Depth.
- Rendering Path to Forward.
This should be enough, but make sure that Main Camera settings are correct.
- Clear Flags usually should be Skybox or Solid Color.
- Culling Mask should have your 3D scene objects layers included.
- Depth must be lower than GUI Camera depth.
- Rendering Path must be set to Use Player Settings or Deferred Lighting.