Skip to content

Instantly share code, notes, and snippets.

Shader "Custom/yar" {
Properties {
_ColorLow ("Color Low", COLOR) = (1,1,1,1)
_ColorHigh ("Color High", COLOR) = (1,1,1,1)
_yPosLow ("Y Pos Low", Float) = 0
_yPosHigh ("Y Pos High", Float) = 10
_GradientStrength ("Graident Strength", Float) = 1
_EmissiveStrengh ("Emissive Strengh ", Float) = 1
_ColorX ("Color X", COLOR) = (1,1,1,1)
_ColorY ("Color Y", COLOR) = (1,1,1,1)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
/// <summary>
/// A simple free camera to be added to a Unity game object.
///
/// Keys:
@aras-p
aras-p / OnlyShadowsAndAtten.shader
Created December 9, 2015 14:08
Shadows and Attenuation Only Shader
Shader "Custom/OnlyShadowsAndAtten"
{
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
// Forward rendering base (main directional light) pass.
Pass
{
@djcsdy
djcsdy / Unity with source control.md
Last active March 26, 2024 20:04
Unity with source control

In the Unity editor:

  1. Edit -> Project Settings -> Editor
  2. In the inspector panel, set:
  3. Version Control -> Mode: Visible Meta Files
  4. Asset Serialization -> Mode: Force Text

“Visible Meta Files” causes Unity to place .meta files next to each of your assets. It’s important to check these files into version control because they contain the settings associated with those assets that you set in the Unity editor.

“Asset Serialization: Force Text” causes Unity to write its .meta and other files in a more-or-less human-readable text format, which makes it a lot easier to understand what has changed when you look at version control logs. Also it’s feasible to merge these text files by hand, whereas it’s not really possible to do that with Unity’s default binary file format.

@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
@JohannesDeml
JohannesDeml / TooltipDrawer.cs
Last active April 13, 2021 20:58
Unity Tooltip drawer for Material properties using reflection
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TooltipDrawer.cs" company="Supyrb">
// Copyright (c) 2018 Supyrb. All rights reserved.
// </copyright>
// <author>
// Johannes Deml
// send@johannesdeml.com
// </author>
// --------------------------------------------------------------------------------------------------------------------
@Pyredrid
Pyredrid / GradientTextureDrawer.cs
Last active May 17, 2024 09:19
Gradient Texture Material Property Drawer
using UnityEngine;
using UnityEditor;
using System;
using System.Runtime.InteropServices;
/// <summary>
/// Use with "[GradientTexture]" before a texture shader property.
/// Gives a gradient editor instead of a texture selector when viewing
/// in the editor. Meaning you don't have to open any paint programs
/// to make gradient textures.
@phi-lira
phi-lira / UnlitTextureShadows.shader
Created April 30, 2020 08:28
Unlit Texture + Realtime Shadows shader
Shader "Universal Render Pipeline/Custom/UnlitTextureShadows"
{
Properties
{
[MainColor] _BaseColor("BaseColor", Color) = (1,1,1,1)
[MainTexture] _BaseMap("BaseMap", 2D) = "white" {}
}
SubShader
{
@MagistrAVSH
MagistrAVSH / URP-VertexLit.shader
Last active March 28, 2024 22:06
UniversalRenderingPipeline VertexLit Shader
Shader "Universal Render Pipeline/Custom/VertexLit"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Gain ("Gain", Float) = 1.5
_Color ("Color", Color) = (1,1,1,1)
_EdgeColor ("Edge Color", Color) = (0,0,0,1)
[Toggle] _RemoveDiag("Remove diagonals", Float) = 0.
@hmans
hmans / BobTheBuilder.cs
Last active April 27, 2024 23:26
A basic pipeline for performing headless Unity builds for multiple platforms at once.
/* This needs to live in a folder named "Editor", or it won't work. Doesn't have to be named
"BobTheBuilder", though. Name it whatever you want! */
using System;
using UnityEditor;
using UnityEngine;
public class BobTheBuilder
{
/* List of scenes to include in the build */