Author Topic: Using UI Grid as board game template?  (Read 3860 times)

jayhayes87

  • Guest
Using UI Grid as board game template?
« on: September 13, 2012, 12:47:26 PM »
Hey guys!  I have a question about using UI grid for a tiled board game, and some direction on how i should be setting that up.

First off, i want to say that NGUI is an excellent tool.  It is simple, easy to understand and use, and very versatile.  Being a mobile game designer, I am excited that there is an alternative to Unity's GUI tools, which would hinder my designs greatly.

Back to my question!  I purchased "tile based map and nav" add on for unity thinking that it would make my setup easier, but it turns out that it might be a bit much for a mobile device, and using NGUI for both the GUI and the playing board would not only flow much better, but show an increase on the performance side as well.

I have been messing around trying to find the correct way to set this up, but for the life of me can not figure it out.  I am new to the world of programming (artist who recently turned to programming out of necessity) but am picking up on it rather quickly and find it very interesting. 

All i want to know is how to set up a grid on a 3D object where i can drag and drop other 3D objects on and around the grid.

PS.  I am guessing that the grid is strictly "behind the scenes" code and will not render any visuals such as borders or tiles, and that textures will have to be used in conjunction with the coordinates of the grid.

Any help is much appreciated.  Thanks in advance and i apologize for the lengthy post!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Using UI Grid as board game template?
« Reply #1 on: September 13, 2012, 04:23:58 PM »
I'm not sure what you mean by "a grid on a 3D object". You can set up a grid easily by adding objects at regular intervals (or using UIGrid). Drag & drop is achieved by adding colliders to the objects as well as the drag & drop scripts like in the inventory or drag & drop examples.

jayhayes87

  • Guest
Re: Using UI Grid as board game template?
« Reply #2 on: September 15, 2012, 02:44:19 PM »
Thanks for the reply!

     I simply just want to use NGUI to lay a grid on a plane that i can move objects around on, like a tiled game board.  Is that possible?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Using UI Grid as board game template?
« Reply #3 on: September 16, 2012, 01:20:35 AM »
Laying out object on a grid is easy -- UIGrid as I mentioned. Moving them around -- this will require coding on your part assuming you want them to "snap" to cells. Your best bet is to take a look at the inventory example. The backpack in it is a grid of items that you can drag around -- which sounds like what you want.

jayhayes87

  • Guest
Re: Using UI Grid as board game template?
« Reply #4 on: September 16, 2012, 06:01:56 PM »
thanks!  i will give it a shot