Skip to content

Instantly share code, notes, and snippets.

@beardordie
Created August 18, 2018 03:54
Show Gist options
  • Save beardordie/0da9737b58cfb92bda50b1663f5ad89e to your computer and use it in GitHub Desktop.
Save beardordie/0da9737b58cfb92bda50b1663f5ad89e to your computer and use it in GitHub Desktop.
Unity UI Camera - Always On Top - Setup Instructions
If you would like to have some UI elements in world space, but always appear on "top" (never obscured by other world objects), here is the setup:
- Create a new camera as a child of your main camera, this is your UI camera
- Zero out the new camera's transform position, and match its FOV with the parent camera
- Set the Layer of this camera to UI
- Set Clear Flags to Depth only
- Set Culling mask to none then to only the UI layer
- On your main camera, set Culling mask to omit the UI layer
After doing this, any canvas or UI elements on that canvas set to the UI layer will only use the UI camera to render, and will not be hidden by intersecting world objects. i.e. they will be Always On Top
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment