Placing a grid
Navigate to /Prefabs/WholeGrids, drag in one of the premade grids and adjust the General settings such as height, width and cellSize.
Best to keep the cellSize at 1 = 1 metre. However, everything will adjust if you decide to change it.
If you want the grid to be above some existing terrain, move the grid on the Y-axis slightly above. A value of 0.015 works well.
You can use as many grids as you want, 1, 10 or 50, it’s up to you.
There is no ‘Hard’ limit on width or height, I have tested up to 90,000 cells with 300 height and 300 width which starts to slow down on my mid-range machine.
Caution to increasing grids and cells quantity will certainly affect performance after certain thresholds dependent on your hardware.
Adding prefab modules
New in Grid Builder 2 is the GridBuilder2Manager component. You will need one of these in your scene and get it straight from the /Prefabs folder.
Navigate to /Prefabs and drag in a GridSelector, ObjectPlacer, and ObjectRemover. You should only have one of each of these.
You can also drag in an ObjectSelector and GridObjectOptions if you like.
Back in /Prefabs, drag in a PickBuildingBtn and RemoveModeBtn.
This will create a canvas so you can move the buttons somewhere convenient.
By default, the PickBuildingBtn is empty and you will need a placeable object to use. Navigate to the Demo/Resources/PlaceableObjects folder and pick a 3D prefab to use. Drag this prefab with the Building class under the Building slot on the PickBuildingBtn. Please note there is no scaling done to prefabs, so the models will have to match the grid size. Default grid cell size is 1 = 1 metre.
You can also place buildings with a key press as well. If you want to do this, you can add the PlaceBuildingWithKey prefab in the scene, assign a key value, and a building and voila.
Under the Building component you can now set the rough size of your objects. Setting this up is easy and only requires you know the size and direction of your object. Check the demo scenes Building classes in the demo scenes packaged with the project to get an idea on how to set this up. This article explains further about setting this up from scratch for your own objects https://golemitegames.com/index.php/docs/setting-up-the-building-component-and-pickobjectbtn/
Make sure to add colliders to placeable objects.
Add all of your seperate components/modules to the GridBuilder2Manager component and you are set.
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 click on an object to select it, and move it around after placing it down.
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.
There are many things to customise in Grid Builder 2. The best possible way of trying out most of the features is through the demonstration scenes.
Almost every scene uses a differerent combination of objects and grids to show all of the possibilities of Grid Builder 2.