Skip to content

Instantly share code, notes, and snippets.

@geolands
geolands / Sprite-Lit-Rotatable.shader
Last active June 24, 2024 02:44
A replacement for the Unity 2D default lit sprite shader which supports correct lighting of sprites rotated relative to the camera. This shader was created by making small modifications to the shader from URP 12.1.7. The only change was to move the lighting uv calculation from the vertex shader to the fragment shader.
Shader "Universal Render Pipeline/2D/Sprite-Lit-Rotatable"
{
Properties
{
_MainTex("Diffuse", 2D) = "white" {}
_MaskTex("Mask", 2D) = "white" {}
_NormalMap("Normal Map", 2D) = "bump" {}
// Legacy properties. They're here so that materials using this shader can gracefully fallback to the legacy sprite shader.
[HideInInspector] _Color("Tint", Color) = (1,1,1,1)
@geolands
geolands / UnityGuidRegenerator.cs
Last active August 6, 2019 21:03 — forked from ZimM-LostPolygon/UnityGuidRegenerator.cs
Unity asset GUIDs regenerator
// Drop into Assets/Editor, use "Tools/Regenerate asset GUIDs"
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using UnityEditor;
namespace UnityGuidRegenerator {
public class UnityGuidRegeneratorMenu {