Skip to content

Instantly share code, notes, and snippets.

View jeffvella's full-sized avatar
🏠
Working from home

Jeffrey Vella jeffvella

🏠
Working from home
  • Montréal, Canada
View GitHub Profile
@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;
@Alexander-van-der-Zalm
Alexander-van-der-Zalm / OnChangedCallAttribute.cs
Last active March 2, 2023 00:16
Unity3D - PropertyAttribute - OnChanged Call a method (basic)
using System.Linq;
using UnityEngine;
using UnityEditor;
using System.Reflection;
/// Feel free to us this. :)
public class OnChangedCallAttribute : PropertyAttribute
{
public string methodName;
@michalbrzozowski
michalbrzozowski / MultipleWorlds.cs
Created May 22, 2018 07:12
Sample showing a potential way to start and run multiple worlds.
using System;
using System.Linq;
using UnityEngine;
using Unity.Entities;
public class WorldBootstrap
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
public static void Initialize()
@GrabYourPitchforks
GrabYourPitchforks / memory_docs_samples.md
Last active April 3, 2026 16:09
Memory<T> API documentation and samples

Memory<T> API documentation and samples

This document describes the APIs of Memory<T>, IMemoryOwner<T>, and MemoryManager<T> and their relationships to each other.

See also the Memory<T> usage guidelines document for background information.

First, a brief summary of the basic types

  • Memory<T> is the basic type that represents a contiguous buffer. This type is a struct, which means that developers cannot subclass it and override the implementation. The basic implementation of the type is aware of contigious memory buffers backed by T[] and System.String (in the case of ReadOnlyMemory<char>).
@JoeCoo7
JoeCoo7 / Components
Last active January 20, 2020 19:45
Component Transform with Scale
using Unity.Entities;
using Unity.Mathematics;
//----------------------------------------------------------------------------------------
[System.Serializable]
public struct ModelMatrix : IComponentData
{
public float4x4 Value
}
public class ModelMatrixComponent : ComponentDataWrapper<ModelMatrix> { }
@vurtun
vurtun / _GJK.md
Last active April 8, 2026 16:32
3D Gilbert–Johnson–Keerthi (GJK) distance algorithm

Gilbert–Johnson–Keerthi (GJK) 3D distance algorithm

The Gilbert–Johnson–Keerthi (GJK) distance algorithm is a method of determining the minimum distance between two convex sets. The algorithm's stability, speed which operates in near-constant time, and small storage footprint make it popular for realtime collision detection.

Unlike many other distance algorithms, it has no requirments on geometry data to be stored in any specific format, but instead relies solely on a support function to iteratively generate closer simplices to the correct answer using the Minkowski sum (CSO) of two convex shapes.

@frideal
frideal / UnityExposedReferenceExample.cs
Last active October 9, 2025 08:14
Unity ExposedReference Example
## Unity Exposed Reference Example
--------------------------------------MoveTarget.cs
namespace ScriptableObjectExample
{
public class MoveTarget : MonoBehaviour
{
}
@hasanbayatme
hasanbayatme / README.md
Last active January 15, 2024 06:59
A Scene Switcher Utility Window for Unity

Scene Switcher

A Scene Switcher Utility Window for Unity, Switch between Scenes Effortlessly.

Inspired by Kenney sceneWindow.cs

Deprecation Notice

This gist is deprecated due to release of this utility on Asset Store, you can now get the latest version of this utility from Asset Store, but it is available here as is without any updates.

@hasanbayatme
hasanbayatme / README.md
Last active January 22, 2024 10:25
A Scene Manager Utility Window for Unity

Scene Manager

A Scene Manager utility window for Unity.

Inspired by Kenney sceneWindow.cs

Deprecation Notice

This gist is deprecated due to release of this utility on Asset Store, you can now get the latest version of this utility from Asset Store, but it is available here as is without any updates.

@zarxor
zarxor / ThrottleAttribute.cs
Last active January 1, 2019 21:00
Request throttling for .NET Core MVC
[AttributeUsage(AttributeTargets.Method)]
public class ThrottleAttribute : ActionFilterAttribute
{
public string Name { get; set; }
public int Seconds { get; set; }
public string Message { get; set; }
private static MemoryCache Cache { get; } = new MemoryCache(new MemoryCacheOptions());
public override void OnActionExecuting(ActionExecutingContext c)