Instantly share code, notes, and snippets.

View SubdivideDialog.cs
using UnityEngine;
using System;
using System.Collections;
public class SubdivideDialog : Dialog {
ThingPart thingPart;
bool dropVertexMoverOnClosing = true;
VertexMover vertexMover = null;
GameObject confirmButton = null;
View spherize.shader
Shader "Unlit/spherize"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Radius ("Radius", Float) = 1.0
_Amount ("Amount", Float) = 1.0
}
SubShader
{
View HexDots.shader
Shader "Custom/HexDots"
{
Properties
{
_DotCount("Dot Count", float) = 11
_Distance("Size", Range(0,1)) = 1
_TColor("Top Color", Color) = (1,1,1,1)
_BColor("Bottom Color", Color) = (1,1,1,1)
_Speed("Speed", float) = 10
View bufferA.glsl
// responsible for handling mouse and setting global states
vec4 data = vec4(0); // data (fragment color) to write
ivec2 fc; // current fragment coords
// how quick to blend to target state
const float TARGET_LERP_RATE = 0.08;
// store a value in the current row (fc.y)
void store(int dst_col, vec4 dst_value) {
View LightweightPipelineTemplateShader.shader
// When creating shaders for Lightweight Pipeline you can you the ShaderGraph which is super AWESOME!
// However, if you want to author shaders in shading language you can use this simplified version as a base.
// Please not this should be only use for reference only.
// It doesn't match neither performance not feature completeness of Lightweight Pipeline Standard shader.
Shader "LightweightPipeline/Physically Based Example"
{
Properties
{
// Specular vs Metallic workflow
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0
View PasteSerialized.cs
// https://www.reddit.com/r/Unity3D/comments/94rpgc/i_wrote_a_piece_of_code_that_allows_for/
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
public static class ComponentUtil
{
static SerializedObject source;
[MenuItem("CONTEXT/Component/Copy Serialized")]
public static void CopySerialized(MenuCommand command)
View beatsabre.json
{
"_leaderboardsData": [
{
"_leaderboardId": "Level1_Expert_PartyStandard",
"_scores": [
{
"_fullCombo": false,
"_playerName": "ANDYB",
"_score": 116590,
"_timestamp": 1528234428
View latzko.shader
Shader "Custom/Latsko"{
Properties {
_Color ("Diffuse Material Color", Color) = (1,1,1,1)
}
SubShader {
Pass {
Tags { "LightMode" = "ForwardBase" } // pass for
// 4 vertex lights, ambient light & first pixel light
CGPROGRAM
View ShadeVertexLightsAtten.cginc
float3 ShadeVertexLightsAtten (
float4 lightPosX, float4 lightPosY, float4 lightPosZ,
float3 lightColor0, float3 lightColor1, float3 lightColor2, float3 lightColor3,
float4 lightAttenSq,
float3 pos)
{
// to light vectors
float4 toLightX = lightPosX - pos.x;
float4 toLightY = lightPosY - pos.y;
float4 toLightZ = lightPosZ - pos.z;
View TriplanarWorld.shader
Shader "Tri-Planar World" {
Properties {
_Side("Side", 2D) = "white" {}
_Top("Top", 2D) = "white" {}
_Bottom("Bottom", 2D) = "white" {}
_SideScale("Side Scale", Float) = 2
_TopScale("Top Scale", Float) = 2
_BottomScale ("Bottom Scale", Float) = 2
}