In a Unity game, I have a scene with a Canvas mixed in with the legacy OnGUI system. The UI drawn by OnGUI appears on top of Canvas so in order to make it the other way around (Canvas on top of OnGUI), I did the following:
- Changed the Render Mode of the Canvas to World Space.
- Added a new camera called UI Camera.
- Set Clear Flags for UI Camera to Depth only.
- Set Depth to 10.
- On my Main Camera, i selected Copy Component.
- On UI Camera, i selected Paste Component Values.
- On UI Camera, only leave "UI" option checked.
- On Main Camera, uncheck "UI" option.
- Delete Audio Listener component on UI Camera.
The Main Camera has a Cinemachine Brain component attached to it. The Canvas UI is triggered by a button press. When I pressed the button in question the whole game froze.
What could be the problem here?