Easy Grid Builder Pro
Last updated
Last updated
This component handles all the Easy Grid Builder Pro grid-based functionalities. And this is the major component you will be using the most to manipulate the grid data.
You can find this component under EGB Pro > Easy Grid Builder Pro XZ and Easy Grid Builder Pro XY in the EGB Pro prefab. You can find the EGB Pro prefab located in EasyGridBuilder Pro > Prefabs.
Since this component has many properties, we are going to divide it into smaller sections to cover all the features.
You can find "GRID LITE" and "GRID PRO" buttons under this section. By default, start with GRID PRO enabled and you can switch back to GRID LITE version by simply clicking on "GRID LITE button".
The major differences between GRID LITE and GRID Pro versions are as follows,
GRID PRO
Provide all the functionalities current Easy Grid Builder Pro provides
GRID LITE
Does not support Buildable Free Objects. Does not support Vertical Grid Levels.
NOTE: GRID LITE is simply a lighter version of the GRID PRO and it is more suitable for 2D games. But the majority of the time you will want to use GRID PRO version.
Buildable Grid Object Type SO List
BuildableGridObjectTypeSO assets. These are the prepared buildable grid objects.
No
Buildable Free Object Type SO List
BuildableFreeObjectTypeSO assets. These are the prepared buildable free objects.
No
Grid Axis
Grid axis XZ or XY. Axis XZ is more suitable for 3D games and XY is more suitable for 2D games.
Yes
Grid Width
Width of the grid (Number of cells in the first axis)
Yes
Grid Length
Length of the grid (Number of cells in the second axis)
Yes
Cell Size
Size of a single grid cell (Size 1 = 1 Unity Unit)
Yes
Grid Origin XZ/XY
Depending on Grid Axis, the grid's local origin. This is locked if "Use Holder Position As Origin" is enabled.
No
Use Holder Position As Origin
Set the holder object's local position as the grid's local position (Simply move the holder object to move the grid)
No
Vertical Grid Data section is currently in beta stage. You can still use this feature but, it is not fully stable as of yet. Easy Grid Builder Pro v1.2.0 update will have a full release of this feature. See what's upcoming on EGB Pro using Trello.
By adding multiple vertical grids you can build objects vertically on top of each other. This can be very useful for modular buildings, Interior build systems, vertical-level buildings and so much more.
Vertical Grids Count
The number of grids should be created vertically (If it's 1, only the base grid will be created)
Yes
Grid Height
The height (space) between vertical grids. If "Vertical Grids Count" is 1, this property is ignored.
Yes
Change Height With Input
Switch between vertical grid levels using a provided input
No
Auto Detect Height
Switch between vertical grid levels automatically. This is calculated using the mouse position. If "Change Height With Input" is also enabled, this property will be ignored.
No
By enabling buildable distance you can add distance check conditions for placing objects on the grid. This can be useful especially in Third & First person perspectives to prevent object placement far from the player character.
Use Buildable Distance
Enable buildable distance check settings
No
Distance Check Object
Object transform that will be used to check the buildable distance from. If empty Main Camera will be used.
No
Distance Min
The minimum distance from the Distance Check Object
No
Distance Max
The maximum distance from the Distance Check Object
No
This part of the component handles the collision check and the gird collider options.
Grid Object Colliding Layer
Layer that buildable grid objects should collide. Set this layer mask to the "Grid Surface" layer.
Yes
Free Object Colliding Layer
Layer that buildable free objects should collide. Set this layer mask to the "Grid Surface" layer and by adding other layers you can build free objects on top of other layer objects (Ex: Default layer).
Yes
Collider Size Multiplier
Set the grid's "Collider Size Multiplier" relative to the grid's size (1 = collider size equal to the gird's size)
Yes
Lock Collider On Height Change
When enabled grid collider position will change according to the current active vertical grid's position
No
You can see an example use of the "Collider Size Multiplier" of 2 (the collider is 2x the size of the grid) in the top image. Here you can move your ghost-buildable object outside of the grid area and it will still display. This is because it's still inside the collider's bounds. When the mouse pointer is outside the collider's bounds ghost-buildable object visual will disappear.
NOTE: When using multiple grids, make sure to set their colliders not to overlap with each other. Otherwise, it can cause unnecessary issues.
This section controls all grid visual data. There are four unique methods you can use to display your grid visuals and you can use one or more of these methods at the same time.
This is the default grid visual solution for the Easy Grid Builder Pro and it is highly customizable and extremely performant. This visual is available in the editor and in the play mode.
Show Editor&Runtime Canvas Grid
Enable using the canvas grid
No
Grid Canvas Prefab
Add provided Grid Canvas prefab (located in EasyGridBuilder Pro > Prefabs > Canvas Grid Samples)
Yes
Grid Image Sprite
Add a custom sprite to use as the grid cell image (pre-made sprites are located in EasyGridBuilder Pro > Prefabs > Canvas Grid Samples)
No
Show Color
Color of the grid visual when it is being displayed
No
Hide Color
Color of the grid visual when it is not being displayed (by default alpha value set to 0)
No
Color Transition Speed
Speed of the color transition when switching between show visual color and hide visual color
No
Show On Default Mode
Show canvas grid visual in Default Grid Mode in play mode
No
Show On Build Mode
Show canvas grid visual in Build Grid Mode in play mode
No
Show On Destruction Mode
Show canvas grid visual in Destruction Grid Mode in play mode
No
Show On Selection Mode
Show canvas grid visual in Selection Grid Mode in play mode
No
Lock Canvas Grid On Height Change
When disabled canvas grid visual will change it's position according to the current active vertical grid's position
No
As displayed in the image above, the canvas grid visual is functioning at runtime.
This is the quickest and most simple grid visual solution for the Easy Grid Builder Pro. This visual is available in the editor and in the play mode.
Show Editor&Runtime Debug Grid
Enable using the debug grid
No
Grid Lines Color
Color of the debug grid
No
Lock Debug Grid On Height Change
When disabled debug grid visual will change its position according to the current active vertical grid's position
No
As displayed in the image above, the debug grid visual is functioning at runtime.
With this grid visual method you can spawn objects in each grid cell. This visual is only available in the play mode.
Show Runtime Node Grid
Enable using the node grid
No
Grid Node Prefab
Prefab object to spawn in each grid cell. If multiple provided, a random prefab will spawn in each cell.
Yes
Grid Node Size Percentage
Size percentage of the provided node prefab
No
Grid Node Local Offset
The local position of each node object relative to the grid cell
No
NOTE: In this method, it spawns objects at the start of the game. Do not use this visual method in larger grids with high cell counts.
As displayed in the image above, the node grid visual is functioning at runtime.
With this grid visual method you can spawn highly customizable text objects in each grid cell. This visual is only available in the play mode.
Show Runtime Text Grid
Enable using the text grid
No
Grid Text Color
Color of the spawned text
No
Grid Text Size Multiplier
Size multiplier of the grid text (0.5 = half of the size)
No
Show Cell Value Text
Display each cell's value (first cell = 0,0)
No
Grid Text Prefix
A prefix text to display in text grid
No
Grid Text Suffix
A suffix text to display in text grid
No
Grid Text Local Offset
The local position of each text object relative to the grid cell
No
NOTE: In this method, it spawns objects at the start of the game. Do not use this visual method in larger grids with high cell counts.
As displayed in the image above, the text grid visual is functioning at runtime.
This section of the component cover all the Easy Grid Builder Pro save & load functionalities.
Enable Save & Load
Enable using the grid data save & load
No
Unique Save Name
A unique name to save the file. This must be a unique name and not any other grid system should have the same name.
Yes
Save Location
Save file location. This is a read-only property.
Yes
NOTE: To prevent accidental changes "Save Location" property is set to read-only. You can change it inside the EasyGridBuilderPro.cs script in line 198 as follows.
This section of the component can be used to quickly debug Easy Grid Builder Pro runtime functionalities by enabling console messages for different features in Easy Grid Builder Pro.
Show Console Text
Enable using the grid data save & load
No
Object Placement
Enable console messages when placing objects
No
Object Destruction
Enable console messages when destroying objects
No
Object Selected
Enable console messages when selecting objects
No
Grid Level Change
Enable console messages when changing the vertical grid level
No
Save And Load
Enable console messages when saving and loading grid data
No
As displayed in the image above, the debug console messages are functioning at runtime.
This last section of the component is extremely powerful and can be used to hook your own functionalities to the Easy Grid Builder Pro events directly, add extra features and much more.
On Selected Buildable Changed Unity Event
This event will fire up when selecting a new object to build from UI or from inputs
No
On Grid Cell Changed Unity Event
This event will fire up when a grid cell data is changed (If 5 cells changed at a time, the event will fire up 5 times)
No
On Active Grid Level Changed Unity Event
This event will fire up when the current vertical grid level changes
No
On Object Placed Unity Event
This event will fire up when trying to place a buildable object
No
On Object Removed Unity Event
This event will fire up when trying to destroy a buildable object
No
On Object Selected Unity Event
This event will fire up when a placed object on the grid is selected
No
On Object Deselected Unity Event
This event will fire up when a selected place object on the grid is deselcted
No
You can find an example implementation of unity events in the "3D All In One Demo" located in EasyGridBuilder Pro > Demo Scenes folder.