Set up from scratch

Updated on July 27, 2022

Setting up the grid

Create a new empty gameobject, and add the ‘GridSquare’ script.

If choosing this way, you will need to link up a gridCell prefab from /Prefabs/GridCells if in single-cell mode,

or apply a ‘Simple’ material from /Materials/Grid if in simple mode.

Feel free to play around with the initial settings to align the grid, select height, width and cellsize.

The grid mode is mostly game dependent on your style, complexity and your final output device. Simple is the best to start off with to get the basic idea of usage.

Adding other components

If you are not using the autoCellBlock feature(removes cells depending on certain factors) please continue. Otherwise please follow the documentation on how to set this up.

If you want to use autoCellBlock in your project, it will take seconds to set up when you understand how it works. Please refer to setting up autocellblock to use this. If you choose to try this on your own, you may end up with no cells being created at runtime.

Create a new empty gameobject, and add the ‘GridSelector’ script. You will need to link up the mesh, found in /Meshes/GridSelectors > on the fbx and drag the mesh to meshfilter. You will also need the selector materials, all found in /Materials/GridSelector.

Now you should be able to select the grid, and move around, hazaah.

For placing objects, two components are required. One for creating the actual object, and one for selecting what to build and passing the object to the gridSelector. Create an empty gameobject and place the ‘ObjectPlacer’ script on it, then drag this onto your gridSelector Object Placer. Easy peasy.

You can copy the buttons from my Demo scene, or simply create a new button, and add the ‘SelectObject’ script to it. This script requires one thing, a prefab of an object you want to build on the grid. All this does is passes an object to the gridselector, and then when clicking with the left mouse button, passes the object to the ObjectPlacer to build the object.

Feel free to add any visual element under the button to represent your building.

Hopefully now, you can click the button, and build on the grid, great!

For removing objects, create another button, this time add the ‘RemoveMode’ script on it. Drag the ObjectRemover from /Prefabs into your scene. Or create an empty gameObject, and place the ‘ObjectRemover’ script on it. Add the invalidMaterial from /Material/GridSelector.

Controlling

That’s it! Hit play and you should be able to move, click on an object and place it down on the grid.

You can also hit the removeMode button to highlight and delete objects.

Both placing and deleting objects is done with the left mouse button and cancelling either is done with either the right mouse button or escape.

Customisation

After this, there is quite a bit to play around with, particularly the AutoCellBlock feature. Please read the documentation on how to set this up.

It’s super simple and quick to set up once you know how it works.

You can create all of these prefabs from scratch if you like, creating an empty game object and adding the relevant scripts to them as components. You will certainly need to assign materials, and certain prefabs to them if you want to do it this way. All the folders are clearly marked so you should not have any trouble finding them.

Still need help? Contact support at support@golemitegames.com

Please describe your issue in detail and if possible, provide screenshots to help us understand your problem better and answer your question more effectively.