Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using System.IO;
using System.Reflection;
[InitializeOnLoad]
public static class ShowFileExtensions
{
@nemotoo
nemotoo / .gitattributes
Last active April 23, 2025 10:01
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@maxattack
maxattack / QuaternionUtil.cs
Last active April 3, 2025 14:13
Some Helper Methods for Quaternions in Unity3D
using UnityEngine;
/*
Copyright 2016 Max Kaufmann ([email protected])
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
@keijiro
keijiro / ToggleTest.shader
Last active August 20, 2024 10:33
Shows how to use the Toggle material property drawer in a shader. See the reference manual for further details: http://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html
Shader "ToggleTest"
{
Properties
{
[Toggle(FILL_WITH_RED)]
_FillWithRed ("Fill With Red", Float) = 0
}
SubShader
{
Pass
@sugi-cho
sugi-cho / v2fStandard-Deferred.shader
Last active August 25, 2019 18:32
Generateされた、standard shaderを要らないpassを削って使いやすくしたもの(deferred pass のみ)。 影をいじりたかったら、cast shadow のpassを追加する必要あり。vertexいじらなかったら、影は不自然じゃなく落とせる。
Shader "Custom/Generated-SurfDeferred" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
CGINCLUDE
#include "HLSLSupport.cginc"
#ifndef NOISE_SIMPLEX_FUNC
#define NOISE_SIMPLEX_FUNC
/*
Description:
Array- and textureless CgFx/HLSL 2D, 3D and 4D simplex noise functions.
a.k.a. simplified and optimized Perlin noise.
The functions have very good performance
and no dependencies on external data.
@JohnnyBeluga
JohnnyBeluga / Unity Basic Tessellation Shader
Last active April 4, 2018 05:01
Basic triangle Unity ShaderLab Shader; Tessellates a triangle mesh and colors it red.
Shader "Tesselation/Triangle_Tesselation" {
Properties {
_TessEdge ("Edge Tess", Range(1,64)) = 2
}
SubShader {
Pass {
CGPROGRAM
#pragma target 5.0