https://github.com/volorf/grid-mesh
Create a procedural mesh-based grid for your cool Unity 3D project.
https://github.com/volorf/grid-mesh
csharp grid grid-mesh mesh meshgeneration procedural procedural-mesh unity3d
Last synced: about 1 year ago
JSON representation
Create a procedural mesh-based grid for your cool Unity 3D project.
- Host: GitHub
- URL: https://github.com/volorf/grid-mesh
- Owner: Volorf
- License: mit
- Created: 2020-09-15T19:01:22.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-09-17T08:33:17.000Z (almost 4 years ago)
- Last Synced: 2025-04-25T10:44:16.734Z (about 1 year ago)
- Topics: csharp, grid, grid-mesh, mesh, meshgeneration, procedural, procedural-mesh, unity3d
- Language: C#
- Homepage:
- Size: 29.7 MB
- Stars: 26
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Grid Mesh
Create a procedural mesh-based grid for your cool Unity 3D project.

## How to install the package
#### 1. Copy the Git URL
#### 2. Open **`Window/Package Manager`** and paste the URL
#### 3. Add the component

## How to set it up via Inspector

* **`X Segments`** defines how many cells you will get on the X-axis.
* **`Y Segments`** defines how many cells you will get on the Y-axis.
* **`X Step`** defines cell's width.
* **`Y Step`** defines cell's height.
* **`Material`** allows you to set up material.
* **`isCentered`** Centers the grid to the centre of the game object
## How to set it up via Code
You have a bunch of properties you can tweak to control the grid.
```csharp
using UnityEngine;
public class GridMeshManager : MonoBehaviour
{
public Material gridMat;
private GridMesh _gridMesh;
private void Awake()
{
// Get GridMesh component
_gridMesh = GetComponent();
// How many cell you will get on the X axis
_gridMesh.xSegments = 8;
// How many cell you will get on the Y axis
_gridMesh.ySegments = 16;
// Cell width
_gridMesh.xStep = 1.0f;
// Cell height
_gridMesh.yStep = 0.5f;
// Sets a material. By default it's magenta
_gridMesh.material = gridMat;
// Centers the grid to the game object
_gridMesh.isCentered = true;
}
}
```
## Good to know
* Developed with Unity 2019.4 7f1. Tested with higher versions, it worked well;
* Right now you can't change the thickness of the lines.
## Links
[Portfolio](https://olegfrolov.design/) | [Linkedin](https://www.linkedin.com/in/oleg-frolov-6a6a4752/) | [Dribbble](https://dribbble.com/Volorf) | [Twitter](https://www.twitter.com/volorf)