Skip to content

Instantly share code, notes, and snippets.

@sir-hc-daudore
sir-hc-daudore / InstanceRenderer.cs
Created March 3, 2022 05:36
Rendering many meshes using GPU instancing
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// Class for drawing meshes using the Graphics.DrawMeshInstanced method.
// At initialization, generates a list of transform matrices,
// each representing an object and its position.
// During update steps, it sends draw requests for the objects using
// Graphics.DrawMeshInstanced and providing the meshes' transform matrix array.
public class InstanceRenderer : MonoBehaviour
@sir-hc-daudore
sir-hc-daudore / main.cs
Last active August 6, 2021 19:55
ref and structs modification example
// For more info on how to use ref keywords for modifying structs
// https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/ref
using System;
class MainClass {
public class MyClass {
public float number = 0;
}