Easy Grid Builder Pro XZ / XY

This component handles all Easy Grid Builder Pro grid-based functionalities for the XY and XZ Axes. These are the cornerstone components for manipulating grid data in Easy Grid Builder Pro. These components define how the grid is oriented in your project:

  • XZ Axis: Uses the X and Z coordinates, ideal for 3D games, top-down views, or horizontal layouts

  • XY Axis: Uses the X and Y coordinates, perfect for 2D games, side-view or vertical layouts

Both these components function almost identically, with their main difference being the axis configuration. For simplicity, this documentation will focus on the Easy Grid Builder Pro XZ Component. However, rest assured that the same features and functionalities also apply to the Easy Grid Builder Pro XY Component.

You can find these two core grid scripts in the following directory: SoulGames > Easy Grid Builder Pro 2 > Scripts > Core Grid Scripts > Grid Core

These scripts are attached to the EGB Pro 2 Grid XZ and EGB Pro 2 Grid XY prefabs, which are available here: SoulGames > Easy Grid Builder Pro 2 > Prefabs


Core Grid Properties

Property
Function
Required

Grid Unique ID

The unique ID of this specific Grid.

Yes

Update Grid In Editor

Enable grid updates directly in the Unity Editor

No

Gird Width

Width of the grid (Number of cells along the first axis)

Yes

Grid Length

Length of the grid (Number of cells along the second axis)

Yes

Cell Size

Size of a single grid cell (1 Unit = 1 Unity unit)

Yes

Update Grid Position

Enable grid position updates during runtime.

No

Grid Origin

Sets the grid origin to Centered or Default.

  • Centered: Commonly used in most cases.

  • Default: Used when "Update Grid Width and Length" is enabled.

Yes

Update Grid Width and Length

Enable runtime updates for grid width and length.

No

Active Camera Mode

Displays the current active camera mode, useful for quick debugging.

No

Active Grid Mode

Displays the current active grid mode for this grid system, useful for quick debugging.

No

Active Grid Origin

Displays the active grid origin in world space, useful for debugging.

No

Active Object SO

Displays the currently active Object SO asset, useful for debugging.

No

Active Vertical Grid Index

Displays the current active vertical grid index, useful for debugging.

No


Grid Buildables

This is where you add your prepared Buildable SO assets. All added assets can be placed on the grid during runtime and can also be added or removed dynamically (refer to the API documentation for more details).

Property
Function
Required

Buildable Grid Object SO List

List of Buildable Grid Object SO assets.

No

Buildable Edge Object SO List

List of Buildable Edge Object SO assets.

No

Buildable Corner Object SO List

List of Buildable Corner Object SO assets.

No

Buildable Free Object SO List

List of Buildable Free Object SO assets.

No


Vertical Grid

Vertical grids enable the creation of additional grids above the base grid, allowing for object placement on vertical levels, such as multi-floor buildings or unique modular designs.

Property
Function
Required

Vertical Grid Count

Sets the number of grids to generate. (Default is 1, which generates only the base grid.)

Yes

Vertical Grid Height

Sets the height (distance between each vertical grid). Ignored if the Vertical Grid Count is set to 1.

No

Switch Vertical Grid With Input

Enable switching between vertical grids using the assigned input.

No

Auto Detect Vertical Grid

Enable automatic detection and switching of vertical grid levels based on the pointer's height value using Raycast.

No

Custom Grid Surface Layer Mask

Specifies the Layer Mask for the grid system when using a custom surface, such as Terrain or other surfaces.

No

Auto Detection Layer Mask

Specifies the Raycast Layer Mask for pointer height checking when Auto Detect Vertical Grid is enabled.

No


Grid Collision

This section of the component manages collision checks and grid collider settings.

Property
Function
Required

Collider Size Multiplier

Specifies the collider scale (1 means the collider matches the grid scale).

Yes

Lock Collider At Bottom Grid

When enabled, switching vertical grids will not affect the collider's height level.

No

An example of using a Collider Size Multiplier of 2 (making the collider twice the size of the grid) is shown in the top image. With this setup, you can move your ghost-buildable object outside the grid area, and it will still display because it remains within the collider's bounds. However, when the mouse pointer moves outside the collider's bounds, the ghost-buildable object visual will disappear.

When using multiple grids, ensure their colliders do not overlap to avoid potential issues.


Grid Visuals

These four sections are designed for visualizing your Grid System, each offering a unique display method:

  • Visual - Object Grid and Visual - Canvas Grid: Can be used both in the editor and during runtime.

  • Visual - Runtime Text Grid and Visual - Runtime Procedural Grid: Exclusively for runtime generation.

Each method provides a distinct approach to rendering your grid system based on your needs.


Visual - Object Grid

This is the primary grid visual solution for the Easy Grid Builder Pro 2 and it is highly customizable and performant. This visual is available in the editor and in the play mode.

Lets break down the properties of this into 3 sections. 01. Primary properties. 02. Alpha Mask properties. 03. Scrolling Noise properties.

Primary Properties

In this section, you can configure the primary properties required for the Object Grid visual to function correctly.

Property
Function
Required

Display Object Grid

Toggle to display or hide the grid overlay of Visual - Object Grid

No

Object Grid Prefab

Assign the prefab to be used as the visual representation of the object grid.

Yes

Cell Image Texture

Select the texture to be applied to each cell in the grid for visual customization

Yes

Grid Show Color

Set the color used to display the grid when it is visible

No

Grid Hide Color

Set the color used for the grid when it is hidden

No

Grid Show Color HDR

Enable HDR color settings for the grid's visible state, allowing for high dynamic range color customization. This color multiplies with the Grid Show Color

No

Grid Hide Color HDR

Enable HDR color settings for the grid's hidden state, allowing for high dynamic range color customization. This color multiplies with the Grid Hide Color

No

Color Transition Speed

Adjust the speed at which the grid color transitions between the show and hide states

No

Only Show Active Vertical Grid

Toggle to display only the currently active vertical grid, hiding all other vertical grids

No

Always Lock At First Grid

Toggle to lock Object Grid to the first vertical grid, regardless of other and active vertical grids

No

Display On Grid Mode Default

Enable or disable the display of the object grid in Grid Mode Default (None)

No

Display On Grid Mode Build

Enable or disable the display of the object grid in Grid Mode Build

No

Display On Grid Mode Destroy

Enable or disable the display of the object grid in Grid Mode Destroy

No

Display On Grid Mode Select

Enable or disable the display of the object grid in Grid Mode Select

No

Display On Grid Mode Move

Enable or disable the display of the object grid in Grid Mode Move

No

The Object Grid Prefab property requires a specifically designed prefab to function correctly. A sample prefab can be found at: Assets/SoulGames/Easy Grid Builder Pro 2/Prefabs/Grid Visuals/Object Grid (Object Prefab)

This prefab consists of a Plane GameObject with a Grid Plane Shader Graph Material attached. The material dynamically renders the grid system on the plane, ensuring accurate and visually appealing grid visuals.

If you need multiple grid systems with different colors, follow these steps:

  1. Locate the Material Navigate to: Assets/SoulGames/Easy Grid Builder Pro 2/Misc Assets/Materials/Grid Plane Shader Graph Material.mat.

  2. Duplicate the Material Duplicate the Grid Plane Shader Graph Material to create a new instance.

  3. Duplicate the Object Grid Prefab Find the Object Grid (Object Prefab) in: Assets/SoulGames/Easy Grid Builder Pro 2/Prefabs/Grid Visuals, duplicate it, and open the duplicated prefab in the editor.

  4. Replace the Material In the duplicated prefab, replace the existing material with the new duplicated material.

  5. Customize the New Grid System Use the duplicated prefab for your second grid system. You can now modify the color to set a unique color for the second grid system.

The Cell Image Texture property uses the provided sprite image to tile and create the grid's visual. Sample images are located in: Assets/SoulGames/Easy Grid Builder Pro 2/Misc Assets/Grid Textures/Cell Textures.

If you create your own image, ensure the following properties of your image:

  • Set its Texture Type to Sprite (2D and UI).

  • Set its Wrap Mode to Repeat.

Alpha Mask Properties

In this section, you can add an alpha mask, which can be static or dynamically follow the pointer. This allows you to display the grid visual in a focused area rather than across the entire grid.

Property
Function
Required

Use Alpha Mask

Toggle to enable or disable the use of the alpha mask

No

Alpha Mask Texture

Assign the texture to be used as the alpha mask

Yes

Mask Size

Set the base size of the alpha mask to determine the default area

Yes

Mask World Position

Specify the world position of the alpha mask when it is static

No

Mask Follow Cursor

Toggle to enable the alpha mask to dynamically follow the cursor position

No

Mask Follow Ghost Object

Toggle to enable the alpha mask to dynamically follow the position of the ghost object during placement

No

Mask Add Ghost Object Scale

Toggle to include the ghost object's scale to the size of the alpha mask

No

Custom Surface Layer Mask

Define the layer mask of the custom surfaces, if your grid is on any custom surface like terrain

No

Display On Grid Mode Default

Enable or disable the display of the Alpha Mask in Grid Mode Default (None)

No

Display On Grid Mode Build

Enable or disable the display of the Alpha Mask in Grid Mode Build

No

Display On Grid Mode Destroy

Enable or disable the display of the Alpha Mask in Grid Mode Destroy

No

Display On Grid Mode Select

Enable or disable the display of the Alpha Mask in Grid Mode Select

No

Display On Grid Mode Move

Enable or disable the display of the Alpha Mask in Grid Mode Move

No

The Alpha Mask Texture property requires a texture to define the mask for the Alpha Mask. Sample textures can be found at: Assets/SoulGames/Easy Grid Builder Pro 2/Misc Assets/Grid Textures/Alpha Mask Textures.

In these textures:

  • The black areas represent regions with no alpha.

  • The white areas represent regions where the alpha mask is applied (fully visible depending on the contrast).

Scrolling Noise Properties

In this section, you can use scrolling noise to give your grid cells an artistic touch by multiplying another texture with their alpha values. You can also add a scrolling animation in a specific direction to enhance the visual effect.

Property
Function
Required

Use Scrolling Noise

Toggle to enable or disable scrolling noise

No

Noise Texture

Assign the texture to be used as the scrolling noise, which will be multiplied with the grid cells' alpha values

Yes

Texture Tiling

Set the tiling of the noise texture to control its scale and repetition across the grid

Yes

Texture Scrolling

Define the scrolling direction and speed of the noise texture using a Vector2 value for dynamic visual effects

No

The Noise Texture property uses textures to create the scrolling noise effect. Sample textures can be found at: Assets/SoulGames/Easy Grid Builder Pro 2/Misc Assets/Grid Textures/Scrolling Noise Textures.

To ensure your Scrolling Noise Texture aligns with the grid's scale, set the Texture Tiling values to match your Grid Width and Grid Length values. This ensures the texture scales proportionally with the grid.

Visual - Canvas Grid

This visual is available in the editor and in the play mode.

Property
Function
Required

Display Canvas Grid

Toggle to display or hide the grid overlay of Visual - Canvas Grid

No

Canvas Grid Prefab

Assign the prefab to be used as the visual representation of the canvas grid.

Yes

Cell Image Sprite

Select the texture to be applied to each cell in the grid for visual customization

Yes

Grid Show Color

Set the color used to display the grid when it is visible

No

Grid Hide Color

Set the color used for the grid when it is hidden

No

Color Transition Speed

Adjust the speed at which the grid color transitions between the show and hide states

No

Only Show Active Vertical Grid

Toggle to display only the currently active vertical grid, hiding all other vertical grids

No

Always Lock at First Grid

Toggle to lock Canvas Grid to the first vertical grid, regardless of other and active vertical grids

No

Display On Grid Mode Default

Enable or disable the display of the object grid in Grid Mode Default (None)

No

Display On Grid Mode Build

Enable or disable the display of the object grid in Grid Mode Build

No

Display On Grid Mode Destroy

Enable or disable the display of the object grid in Grid Mode Destroy

No

Display On Grid Mode Select

Enable or disable the display of the object grid in Grid Mode Select

No

Display On Grid Mode Move

Enable or disable the display of the object grid in Grid Mode Move

No

Last updated