Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: TokyoDan on May 08, 2014, 06:58:00 PM
-
Hello Aren,
In my board game the boards are maps of 3D objects:
https://www.dropbox.com/s/k5ev9ho2iuqmjhs/board.png
Via the six board selection buttons on this screen I can select different board shapes and sizes :
https://www.dropbox.com/s/y7kdp0y68f8qtwp/selection.png
I want to be able to show a small preview (like a mini-map) of the corresponding board when I tap and hold on the board selection buttons.
What would be the best way to do this in NGUI? e.g. Should I use UITable? I don't need a detailed explanation. Just please point me in the direction of which NGUI classes/objects I should use.
Regards,
Dan
-
Depends on how flexible you want it to be. One way would be to have an off-screen camera draw the 3D objects into a texture that you would then display using UITexture. Another way would be to have static pre-generated textures loaded and swapped as necessary. Even if going down the "let's instantiate a bunch of widgets for the preview!" route, I wouldn't use a table. Your object positioning there is custom. I'd write a custom script to position the sprites.
-
Thanks Aren.
I already got the custom script which draws the mini-map (a flat cube as a base & background) by placing the 3d objects as positions on the flat cube, making them children of the flat cube, and then scaling everything down to a properly sized mini-map. But I like your idea of an off-screen camera drawing the 3D objects into a texture so I have one question…
How does one draw 3D objects into a texture? (I never heard of that)
Regards,
Dan
-
Look into render textures in Unity. You create a render texture, assign it to a camera, and disable the camera. When you want to update the render texture, call the camera's Render() function.
-
Will do. Thanks.