Skip to content

Instantly share code, notes, and snippets.

View gamemachine's full-sized avatar

Chris Ochs gamemachine

View GitHub Profile
@mzandvliet
mzandvliet / DspApplication.cs
Last active August 4, 2024 18:17
A quick example of how to play a mouse-controlled sine wave using the DSPGraph preview package
using UnityEngine;
using Unity.Collections;
using Unity.Audio;
using Unity.Mathematics;
using Unity.Burst;
using System.Collections;
/*
For allocations inside AudioKernels, use Allocator.AudioKernel
*/
@LotteMakesStuff
LotteMakesStuff / NativeMeshTest.cs
Created August 8, 2018 00:30
[NativeCollections] How to copy a regular .C# array into a NativeArray suuuuuper quick using memcpy. its about as fast as its ever gunna get!
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Mathematics;
using UnityEngine;
public class NativeMeshTest : MonoBehaviour
{
private NativeArray<float3> vertexBuffer;
private Vector3[] vertexArray;
// RaiseTerrain.cs -- a simple script that raises (or lowers) Unity's built in terrain to be level
// with a GameObject's collider(s).
//
// AUTHOR: Martin "quill18" Glaude -- quill18@quill18.com
// LICENSE: CC0
//
// The latest version will always be available at: https://gist.github.com/quill18/9becf56f685e60109551e034385fd8f9
//
using UnityEngine;
@mattvr
mattvr / CurvedPlane.cs
Last active June 5, 2026 09:34
Curved plane for Unity
using UnityEngine;
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
public class CurvedPlane : MonoBehaviour
{
private class MeshData
{
public Vector3[] Vertices { get; set; }
public Vector2[] Uvs { get; set; }
@StagPoint
StagPoint / QuaternionCompression.cs
Last active December 2, 2024 07:38
C# - Use "smallest three" compression for transmitting Quaternion rotations in Unity's UNET networking, from 16 bytes to 7 bytes.
// Copyright (c) 2016 StagPoint Software
namespace StagPoint.Networking
{
using System;
using UnityEngine;
using UnityEngine.Networking;
/// <summary>
/// Provides some commonly-used functions for transferring compressed data over the network using