Skip to content

Instantly share code, notes, and snippets.

View yCatDev's full-sized avatar
🎱
I just exist

Grebenuk Denis yCatDev

🎱
I just exist
View GitHub Profile
@SabinT
SabinT / ObjectPool.cs
Created March 7, 2022 07:47
Generic Object Pooling in Unity 3D
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Lumic.Structure.Procedural
{
public class MeshPool : ObjectPool<Mesh>
{
protected override Mesh CreateNew()
{
@StagPoint
StagPoint / NativePriorityQueue.cs
Last active October 13, 2025 07:58
Priority queue implementation for Unity that uses Native Containers for data storage. This version relies on the stored type implementing the IComparable<T> interface.
// Copyright 2017-2021 StagPoint Software
namespace StagPoint.Collections
{
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
@CheeryLee
CheeryLee / AssetReferenceDrawer.cs
Last active December 18, 2022 10:28
Workaround for Addressables 1.10.0 to get AssetReference work with serialized Dictionary (probably with OdinInspector)
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Text;
using UnityEditor.AddressableAssets;
using UnityEditor.AddressableAssets.Settings;
@grapefrukt
grapefrukt / Polylabel.cs
Last active February 1, 2024 09:18
Polylabel Algorithm for Unity
// modified for usage in Unity by grapefrukt, (removed support for polygons with holes as I do not need it)
// based C# port of Polylabel found here: https://github.com/mapbox/polylabel/issues/26#issue-211932869
// which in turn, is based on Polylabel from https://github.com/mapbox/polylabel
// as the name implies this is useful for placing labels on a polygon
using System.Collections.Generic;
using UnityEngine;
namespace Utilities {
using UnityEngine;
public class MeshBlit : MonoBehaviour
{
public RenderTexture rt;
public Mesh mesh;
public Material material;
public Vector3 meshPosition = new Vector3(0.5f, 0.5f, -1);
@DashW
DashW / RecenterResetter.cs
Last active July 21, 2023 15:44
Unity Behaviour to counteract 're-centering' on the Oculus Quest and keep the camera centered relative to the Guardian Boundaries
using UnityEngine;
// This behaviour disables 're-centering' on the Oculus Quest,
// instead forcing the camera origin to remain centered and
// facing the same direction within the Guardian boundaries,
// even between app restarts.
public class RecenterResetter : MonoBehaviour
{
public OVRCameraRig CameraRig = null;
@3dln
3dln / CameraOrbit.cs
Last active February 11, 2025 04:35
A simple Unity C# script for orbital movement around a target gameobject
// A simple Unity C# script for orbital movement around a target gameobject
// Author: Ashkan Ashtiani
// Gist on Github: https://gist.github.com/3dln/c16d000b174f7ccf6df9a1cb0cef7f80
using System;
using UnityEngine;
namespace TDLN.CameraControllers
{
public class CameraOrbit : MonoBehaviour
@JohannesMP
JohannesMP / LICENSE
Last active October 5, 2025 19:01
[Unity3D] A Reliable, user-friendly way to reference SceneAssets by script.
/*******************************************************************************
* Don't Be a Jerk: The Open Source Software License.
* Adapted from: https://github.com/evantahler/Dont-be-a-Jerk
*******************************************************************************
* _I_ am the software author - JohannesMP on Github.
* _You_ are the user of this software. You might be a _we_, and that's OK!
*
* This is free, open source software. I will never charge you to use,
* license, or obtain this software. Doing so would make me a jerk.
*
@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;
@ditzel
ditzel / KdTree.cs
Last active September 15, 2025 15:31
k-d Tree
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Profiling;
public class KdTree<T> : IEnumerable<T>, IEnumerable where T : Component
{
protected KdNode _root;
protected KdNode _last;