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
@runevision
runevision / BurstSDFGenerator.cs
Created September 11, 2024 07:48
Signed Distance Field generator for Unity with Burst support
/*
Based on the Anti-aliased Euclidean distance transform described by Stefan Gustavson and
Robin Strand. For further information, see https://contourtextures.wikidot.com/ and
https://web.archive.org/web/20220503051209/https://weber.itn.liu.se/~stegu/edtaa/
The algorithm is an adapted version of Stefan Gustavson's code, it inherits the copyright
statement below, which applies to this file only.
The rewrite with Unity Burst support makes the execution 40 times faster by default,
and 75 times faster if the passed in textures are both of type TextureFormat.RGBAFloat.
@FreyaHolmer
FreyaHolmer / AssetCopyUtils.cs
Last active June 12, 2024 07:25
Adds context menu items to assets: Copy/Paste import settings & Copy GUID. Put this script in any Editor/ folder in your project and recompile!
// written by https://github.com/FreyaHolmer so use at your own risk c:
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
/// <summary>Utility functions to copy GUIDs, as well as Copy/Paste import settings</summary>
public static class AssetCopyUtils {
const int CTX_MENU_LOCATION = 70;
@rob5300
rob5300 / bzipall.py
Created November 22, 2020 16:23
BZip each file into its own archive and save into new folder structure. Useful for Source/TF2 server files to download
# BZipAll script to quickly bzip all files in a directory.
# Made by rob5300
# FILL ME IN!!! THIS MAY NOT BE RIGHT FOR YOU!!
# Full path to your 7z.exe executable from your 7z install. Plz download or install it if you need from 7-zip.org
_7zpath = r"C:\Program Files\7-Zip\7z.exe"
#Extensions to ignore
ignore = [".py", ".sp", ".smx", ".bz2"]
@Refsa
Refsa / URPSimpleLit.shader
Created October 31, 2020 09:03
Unity - Shader showing how to write a Simple Lit shader for Unity URP
Shader "Custom/URPSimpleLit"
{
Properties
{
_Color ("Color", Color) = (1,0,0,1)
}
SubShader
{
Tags {
"RenderPipeline" = "UniversalPipeline"
@rob5300
rob5300 / CanvasEditorHelper.cs
Created August 21, 2019 14:26
Applies preset layermask on scene open and restores it on scene closed. Made for use in custom ui prefab editing scenes to show the UI layer automatically.
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
/// <summary>
/// Applies preset layermask on scene open and restores it on scene closed.
/// Made for use in custom ui prefab editing scenes to show the UI layer automatically.
/// </summary>
[ExecuteInEditMode]
public class CanvasEditorHelper : MonoBehaviour
@KenneyNL
KenneyNL / CircularMenu.cs
Last active June 23, 2022 19:41
Circular menu sample code for Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CircularMenu : MonoBehaviour{
public float radius = 100.0f;
public float offset = 0.0f;
void Start(){
Texture2D[] layers;
Texture2D compiledTexture = new Texture2D(layers[0].width, layers[0].height);
foreach(Texture2D layer in layers){
Color[] baseColors = compiledTexture.GetPixels();
Color[] layerColors = layer.GetPixels();
for(int p = 0; p < baseColors.Length; p++){
@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;
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
using System.Collections.Generic;
using System.IO;
// Scene selection
@LotteMakesStuff
LotteMakesStuff / PlayerLoop.cs
Last active September 24, 2024 06: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;