Placing objects that are larger than 1 cell.

Updated on March 24, 2022

By default this is not a feature of grid builder, however, if you are comfortable diving into C# code then below is a brief explanation on how you could expand grid builder.

Bear in mind Grid builder 2 set to release in late April will include this feature and many more.

First of all, you are going to need a way of telling the GridSelector how many and which positions to check. Create a boolean for each position on the SelectObject script such as top, bottom, left, right etc… 


Next, you need to modify the SelectGameObjectToPlace() method on the GridSelector script to take in those new booleans you created. Make sure to pass those new booleans. You could also create a class inside SelectObject to hold these values if you wanted and pass that.


After this, you will need to work out the physical locations of those positions. Do this in the GetCellPositions() in the GridSelector. It should look something like the following for each one –

//Gets the position directly above the center cell
topCheckPos = placementCheckPosition + new Vector3(0, 0, +selectedCellSize);


So all you are doing is working out the topCheckPos from the original centre position. Obviously for cells underneath you will need to subtract. 


Then inside the PlaceObjectIfEmpty method inside the GridSelector script, you now need to check for that newly created position as well. So just add a && to the if block to check that.

//This will be your check for the position to see if it is clear
currentGrid.CheckCellStatus(topCheckPos).


You will need to change the HideSelectorAndPreview to check for that new position also. 
You will also need to mark the new cell as being full in the ObjectPlacer and amend the ObjectRemover to remove that extra cell. 

This should now be able to check for a bigger object than 1 cell big. This can then be expanded and refactored to however you wish.  

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.