Skip to content

Instantly share code, notes, and snippets.

View hammanandre's full-sized avatar

Andre Hamman hammanandre

View GitHub Profile
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System.IO;
using System;
using System.Text.RegularExpressions;
using System.Linq;
// Original code by PlayItSafe_Fries
@billw2012
billw2012 / PBR_ZeroAttenuation.hlsl
Last active September 29, 2022 22:52
Remove point light attenuation in URP
// Drop this into a custom Shader Graph node, then output it to Unlit master Color and Alpha.
// If you want the point light to also behave as a directional light then instead of passing
// the Vertex world position pass the last column of the model Transformation matrix (Transformation node)
// instead.
// NOTE: this function removes GI feature entirely, as it wasn't necessary for my purpose.
void PBR_ZeroAttenuation_half(half3 Albedo,
half Metallic,
half3 Specular,
half Smoothness,
half3 Emission,
@smkplus
smkplus / UniversalPipelineTemplateShader.shader
Created September 9, 2020 15:51 — forked from phi-lira/UniversalPipelineTemplateShader.shader
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
// This one is tied up with JMO toon shading, so I can't just past the shader :/
half _SmushMinZ;
half _SmushXYOffset;
half4 _SmushCenterPos;
half4 initWorldPos;
// Vert
o.initWorldPos = worldPos;
half dist = _SmushMinZ - o.initWorldPos.z;
if(worldPos.z < _SmushMinZ)
import { google } from 'googleapis';
/*******************/
/** CONFIGURATION **/
/*******************/
const googleConfig = {
clientId: process.env.GOOGLE_CLIENT_ID, // e.g. asdfghjkljhgfdsghjk.apps.googleusercontent.com
clientSecret: process.env.GOOGLE_CLIENT_SECRET, // e.g. _ASDFA%DFASDFASDFASD#FAD-
redirect: process.env.GOOGLE_REDIRECT_URL, // this must match your google api settings
@Split82
Split82 / UnityShadersCheatSheet.shader
Created April 17, 2018 10:07
Unity Shaders Cheat Sheet
Shader "Name" {
Properties {
_Name ("display name", Range (min, max)) = number
_Name ("display name", Float) = number
_Name ("display name", Int) = number
_Name ("display name", Color) = (number,number,number,number)
_Name ("display name", Vector) = (number,number,number,number)
@LotteMakesStuff
LotteMakesStuff / EditorCoroutineRunner.cs
Last active May 20, 2022 10:21
Run stuff in the editor with all the convenience of co-routines! Add a status UI super easily to see readouts what your long running code is actually doing! nice~ There is a short API demo at the top of the class. This is a prefect companion for my inspector buttons https://gist.github.com/LotteMakesStuff/dd785ff49b2a5048bb60333a6a125187
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
public class EditorCoroutineRunner
{
[MenuItem("Window/Lotte's Coroutine Runner: Demo")]
@LotteMakesStuff
LotteMakesStuff / HighlightAttribute.cs
Last active May 3, 2024 01:38
Having trouble finding the right property on a component cos theres just so many identical looking fields? Add some color to you inspectors! mark important property with a bright color so it always stands out, or supply a validation function so highlights show on values that would effect the current ingame logic!
// NOTE DONT put in an editor folder
using UnityEngine;
public class HighlightAttribute : PropertyAttribute
{
public HighlightColor Color;
public string ValidateMethod;
public object Value;
@LotteMakesStuff
LotteMakesStuff / StatsBarAttribute.cs
Last active March 24, 2023 16:37
StatsBar property drawer for Unity~ Add a [StatsBar] attribute to a property to make it draw a lil bar, really useful for visualizing character stats like Health or Mana.
// NOTE DONT put in an editor folder
using UnityEngine;
public class StatsBarAttribute : PropertyAttribute
{
public string valueMax;
public StatsBarColor color;
public StatsBarAttribute(string valueMax = null, StatsBarColor color = StatsBarColor.Red)
@LotteMakesStuff
LotteMakesStuff / ReadOnlyAttribute.cs
Created January 17, 2017 00:17
ReadOnly property drawer for Unity~ Add a [ReadOnly] attribute to a property to make it show up as read only in the inspector
// NOTE DONT put in an editor folder
using UnityEngine;
public class ReadOnlyAttribute : PropertyAttribute { }