Skip to content

Instantly share code, notes, and snippets.

View Pixels67's full-sized avatar

Pixels Pixels67

View GitHub Profile
@Pixels67
Pixels67 / Option.cs
Created September 4, 2025 15:05
Rust-style Option<T> implementation in C#
using System;
public readonly struct Option<T>
{
private readonly T value;
private readonly bool isSome;
private Option(T value, bool isSome)
{
this.value = value;
@Pixels67
Pixels67 / Chunk.cs
Last active July 22, 2025 23:02
Voxel chunk mesh handling in Unity.
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
public class Chunk : MonoBehaviour
{
private MeshFilter _meshFilter;
public int[,] Heightmap { get; private set; }
public bool Initialize(uint chunkSize, uint cellSize, int[,] terrainData, Material material)
{
Heightmap = new int[chunkSize, chunkSize];