Skip to content

Instantly share code, notes, and snippets.

View stonstad's full-sized avatar

Shaun Tonstad stonstad

View GitHub Profile
private void AddGreedyQuad(float x, float y, float z, int axisU, int axisV, int axisD, int width, int height, int faceDir,
List<Vector3> verts, List<int> tris, List<Vector2> uvs)
{
float p0x;
float p0y;
float p0z;
float p1x;
float p1y;
float p1z;
@stonstad
stonstad / FrameTimingScript.cs
Last active September 12, 2026 09:36
FrameTimingScript
using UnityEngine;
public class FrameTimingScript : MonoBehaviour
{
public float intervalSeconds = 1f;
private readonly FrameTiming[] _timings = new FrameTiming[1];
private double _cpuSumMs;
private int _cpuSamples;
using System;
using System.Collections.Generic;
using System.Text.Json;
using NUnit.Framework;
using Unity.PerformanceTesting;
using UnityEngine;
public class JsonSerializationPerformanceTests
{
private const int ItemCount = 1000;
@stonstad
stonstad / Program.cs
Last active August 5, 2026 19:26
Benchmark: Reset Static State for 1000 Types
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace StaticResetBenchmark;
public abstract class StaticStateMarker
{
}
This file has been truncated, but you can view the full file.
using System.Collections.Generic;
using Unity.Scripting.LifecycleManagement;
public class ReferenceType
{
public int Value01 = 1;
public int Value02 = 2;
public int Value03 = 3;
public int Value04 = 4;
public int Value05 = 5;