Skip to content

Instantly share code, notes, and snippets.

View rob5300's full-sized avatar
🙃
Trying out new things

Robert rob5300

🙃
Trying out new things
View GitHub Profile
@darktable
darktable / MiniJSON.cs
Created November 30, 2011 23:08
Unity3D: MiniJSON Decodes and encodes simple JSON strings. Not intended for use with massive JSON strings, probably < 32k preferred. Handy for parsing JSON from inside Unity3d.
/*
* Copyright (c) 2013 Calvin Rien
*
* Based on the JSON parser by Patrick van Bergen
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
*
* Simplified it so that it doesn't throw exceptions
* and can be used in Unity iPhone with maximum code stripping.
*
* Permission is hereby granted, free of charge, to any person obtaining
@mikezila
mikezila / BezierMesh.cs
Last active July 18, 2019 17:01
C# for Unity3D. Creates meshes from bezier patches. The resulting meshes are ready-to-render, including texture UVs.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class BezierMesh
{
public Mesh mesh;
public List<Vector2> uvs;
// Calculate UVs for our tessellated vertices
@sigsegv-mvm
sigsegv-mvm / set_weapon_mode.txt
Last active January 31, 2023 12:50
Documentation for attribute class "set_weapon_mode"
"set_weapon_mode" attribute documentation
accurate as of TF2 version ~20160327 (updated for ~20190501)
reverse engineering by sigsegv
General Notes
=============
There are many attributes in the game that map to attribute class "set_weapon_mode", with many different names:
- "fists have radial buff"
- "set cloak is feign death"
@keithcollins
keithcollins / AStarSearch.cs
Created August 30, 2016 23:45
A* pathfinding implementation for Unity 5, C#
using UnityEngine;
using System.Collections.Generic;
using System.Collections;
// This script is adapted from these,
// but has been heavily modified in some areas:
// http://www.redblobgames.com/pathfinding/a-star/implementation.html#csharp
// https://gist.github.com/DanBrooker/1f8855367ae4add40792
// I'm continuing to optimize and change things here. I would not use this
@TheRealMJP
TheRealMJP / Tex2DCatmullRom.hlsl
Last active May 26, 2024 22:43
An HLSL function for sampling a 2D texture with Catmull-Rom filtering, using 9 texture samples instead of 16
// The following code is licensed under the MIT license: https://gist.github.com/TheRealMJP/bc503b0b87b643d3505d41eab8b332ae
// Samples a texture with Catmull-Rom filtering, using 9 texture fetches instead of 16.
// See http://vec3.ca/bicubic-filtering-in-fewer-taps/ for more details
float4 SampleTextureCatmullRom(in Texture2D<float4> tex, in SamplerState linearSampler, in float2 uv, in float2 texSize)
{
// We're going to sample a a 4x4 grid of texels surrounding the target UV coordinate. We'll do this by rounding
// down the sample location to get the exact center of our "starting" texel. The starting texel will be at
// location [1, 1] in the grid, where [0, 0] is the top left corner.
float2 samplePos = uv * texSize;
@cortvi
cortvi / !Refractive Surface Shader.md
Last active March 31, 2022 22:55
Custom refractive liquid surface shader
We couldn’t find that file to show.
// c# companion script
// SpriteUVToShader.cs -------------------------------------------------------------------------------------------------------------------------------- //
// Save you your project, add to your SpriteRenderer gameObject
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[ExecuteInEditMode]
@LotteMakesStuff
LotteMakesStuff / PlayerLoop.cs
Last active March 25, 2024 02:38
Player Loop Visualizer: Built to explore the new PlayerLoopSystem api in Unity 2018.1b2. This tool shows you all the PlayerLoop systems that unity uses to update a frame, and demos how to add your own and even remove systems from the player loop. For more info see the patreon post https://www.patreon.com/posts/unity-2018-1-16336053
// Put this in an editor folder
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Experimental.LowLevel;
using UnityEngine.Profiling;
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
using System.Collections.Generic;
using System.IO;
// Scene selection
@RDeluxe
RDeluxe / BundleManager.cs
Last active August 15, 2018 09:44
BundleManager
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using AssetBundles;
using UnityEngine;
public class BundlesManager {
private static BundlesManager _instance;
private Dictionary<string, AssetBundle> _assetBundles;
private Dictionary<string, Task<AssetBundle>> _loadingAssetBundles;