Skip to content

Instantly share code, notes, and snippets.

@haosizheng
haosizheng / ImageSequenceRecorderWithTransparentBackground.cs
Last active April 14, 2024 14:10 — forked from bitbutter/TransparentBackgroundScreenshotRecorder.cs
Save image sequence in Unity with transparent background.
using UnityEngine;
using System.Collections;
using System.IO;
using UnityEngine.Rendering.Universal;
/*
Usage:
1. Attach this script to your chosen camera's game object.
2. Set that camera's Clear Flags field to Solid Color.
3. Use the inspector to set frameRate and framesToCapture
@herohiralal
herohiralal / GlassShader
Created June 24, 2021 16:30
Glass shader for URP.
Shader "SimpleLit/Glass"
{
Properties
{
[MainTex] _BaseMap ("Base Map", 2D) = "white" { }
[MainColor][HDR] _Color ("Color", Color) = (1, 1, 1, 1)
_BlurStrength("Blur Strength", Range(0, 1)) = 1
_Gloss("Gloss", Range(0, 1)) = 1
_Thickness("Thickness", Range(0, 1)) = 0.5
}
@jd7h
jd7h / script.py
Created February 3, 2020 16:11 — forked from efonte/script.py
Disco Elysium texts
import re
strings = set()
with open('texts.txt', mode='r', encoding='utf-8') as file_input:
content = file_input.read()
regExStr = r'^\s*\d string title = "(?:tooltip\d+|Name|Dialogue Text)"\n\s*\d string value = "((?!(START|input|\w+\(\)|\!\(\w+\(\)\))).+)"$'
compiled = re.compile(regExStr, re.MULTILINE)
matched = compiled.finditer(content)
@BastianBlokland
BastianBlokland / unity_ios_verificationsignature.md
Last active February 16, 2024 22:19
Way to get the game-center verification signature with Unity.

Even tho Unity has implemented a game-center api (Social api) it doesn't have a way to generate a verification signature, which you need to use game-center as a authentication method.

Luckily the objective-c code required is pretty straight forward. (Apple documentation: generateIdentityVerificationSignature)

#import <Foundation/Foundation.h>
#import <GameKit/GameKit.h>

typedef void (*IdentityVerificationSignatureCallback)(const char * publicKeyUrl, const char * signature, int signatureLength, const char * salt, int saltLength, const uint64_t timestamp, const char * error);
@ditzel
ditzel / KdTree.cs
Last active April 7, 2024 08:01
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;
@phi-lira
phi-lira / UniversalPipelineTemplateShader.shader
Last active April 4, 2024 13:42
Template shader to use as guide to create Universal Pipeline ready shaders. This shader works with Universal Render Pipeline 7.1.x and above.
// When creating shaders for Universal Render Pipeline you can you the ShaderGraph which is super AWESOME!
// However, if you want to author shaders in shading language you can use this teamplate as a base.
// Please note, this shader does not necessarily match perfomance of the built-in URP Lit shader.
// This shader works with URP 7.1.x and above
Shader "Universal Render Pipeline/Custom/Physically Based Example"
{
Properties
{
// Specular vs Metallic workflow
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0
@define-private-public
define-private-public / HttpServer.cs
Last active April 9, 2024 08:38
A Simple HTTP server in C#
// Filename: HttpServer.cs
// Author: Benjamin N. Summerton <define-private-public>
// License: Unlicense (http://unlicense.org/)
using System;
using System.IO;
using System.Text;
using System.Net;
using System.Threading.Tasks;
@markvincze
markvincze / JsonAndGZipSerializer.cs
Created January 16, 2016 15:15
Simple GZip compression serializer for Couchbase
using System;
using System.IO;
using System.IO.Compression;
using Couchbase.Core.Serialization;
using Newtonsoft.Json;
namespace CouchbaseContrib
{
/// <summary>
/// A custom <see cref="ITypeSerializer"/> for the Couchbase .NET SDK that uses Json.NET and GZip compression for serialization.
@wpivotto
wpivotto / gist:3993502
Created November 1, 2012 13:02
Maximize VMWare images performance
Insert the following code into the *.VMX file:
sched.mem.pshare.enable = "FALSE"
mainMem.useNamedFile = "FALSE"
prefvmx.minVmMemPct = "100"
prefvmx.useRecommendedLockedMemSize = "TRUE"
mainMem.partialLazySave = "FALSE"
mainMem.partialLazyRestore = "FALSE"
priority.grabbed = "high"
priority.ungrabbed = "normal"