Trying to transition to Unity UI from 2dtoolkit finally and wanted to ask some questions / if this is the right approach…
I have some buttons in game, I want some to float above the game fixed to the camera, and other buttons to sit below the sort order of some items in the 2d scene, but still stay fixed to the camera.
Right now I have one camera for the gui and a Canvas linked via Screen Space, and a game camera that has a Canvas as a child linked via World Space. The game camera is the parent of the world space canvas, because I couldn’t figure out how to make the world space canvas stick with the game camera as it moved (without scripting, I mean in options).
I am using a ui camera and a game camera as sometimes the game camera is switched to a different cam that has no world space buttons visible, but I always want the ui camera to show on top.
This approach look ok or any potential issues?
With the game camera and world space canvas, I want to be able to drop 2d items from the game using the mouse over a Button to trigger an action. What’s the best way to do this? The button doesn’t have 2d physics box does it?
Can I make invisible buttons? When I disable the Image script on a button, the button action no longer works.
Do you have a special need for having orange button on game camera?
I’ve got no idea what it’s for, is it part of world, i.e. local to some spot in 3D world… that would explain it…
but anyway, other than that if you need to show some UI item in front of other objects, if it’s UI object, you can just change it’s Transform’s order in hierarchy using SetAsLastSibling… If it’s 3D object, then I don’t have an answer.
Actually, if you need to sort world space UI relative to world objects, like having a floater above item that renders over all world objects, but floats in world space…
It’s a matter of creating two cameras, then other renders UI and only UI, and main camera renders 3D objects; then UI piggybacks main camera transform, then make main camera farther away in it’s sorting order…