2D Toolkit Forum
2D Toolkit => Support => Topic started by: aphexyuri on April 26, 2013, 09:36:38 pm
-
Hi,
I have a game using the standard Unity camera, and the Unity OnGui for the HUD.
I now want to migrate the HUD to tk2d, in order to have elements anchored to the edges of the screen. I tried to add a tk3dCamera, to render at a higher depth as the main Camera, but the game is just rendering with default blue background, and 'old' scene at the bottom left. (see attachment)
Any pointers on how to accomplish this?
-
Im realy new at this too, but if i had to guess i'd say its because your ortho size is likely incorrect (Needs to be half the height of your targeted resolution), and you haven't adjusted for the tk2d camera using pixels as world units. setting a cube at 100,100,0 for example would put it 100 pixels right, 100 pixels up from the bottom left hand corner of the camera. Add a few test objects to get yourself oriented maybe?
-
I've played around with the ortho sizes, but no luck.
One thing to note...the goal would be to have the standard Camera renders the scene as it was (content to left bottom of screen), and have the tk2dCamera only render the HUD elements (by using layers).
-
1. Set layers on objects + correctly so the fist one draws into the normal camera, and the second into the tk2dCamera only. Disable each camera in turn to make sure each is only drawing what it needs to. At the end of it, remember to re-enable both.
2. Make sure the depth on the second camera (presumably the tk2dCamera) is higher than the first.
2. Set clear mode on the second camera to depth only.
They both should draw properly now.
-
Check sample 6 as well - that has this set up correctly on there.
-
Great! I was missing the Depth Only setting - works well know.
As always, thanks!