Skip to content

Instantly share code, notes, and snippets.

@TocaLucas
TocaLucas / MultiBehaviour.cs
Last active December 22, 2015 17:29
MultiBehaviour
using UnityEngine;
using System.Collections.Generic;
public class MultiBehaviour<T> : MonoBehaviour where T : MonoBehaviour {
private static List<T> _instances;
public static List<T> Instances {
get {
if(_instances == null)
_instances = new List<T>();
@TocaLucas
TocaLucas / SingleBehaviour.cs
Last active December 22, 2015 17:28
SingleBehaviour
using UnityEngine;
using System.Collections;
public class SingleBehaviour<T> : MonoBehaviour where T : MonoBehaviour {
private static T _instance;
public static T Instance {
get {
return _instance;
}
@TocaLucas
TocaLucas / ReplaceMaterials.cs
Last active September 8, 2019 15:45
Unity3D Material Replace Editor
using UnityEngine;
using UnityEditor;
public class ReplaceMaterials : EditorWindow {
static int goCount = 0, replaceCount = 0;
private Material currentMaterial = null;
private Material replaceMaterial = null;
[MenuItem("Stuff/Replace Materials")]
public static void ShowWindow() {
EditorWindow.GetWindow(typeof(ReplaceMaterials));
Shader "Custom/Frost" {
Properties {
_MainTex ("Frost Map (RGB)", 2D) = "white" {}
_FrostColor ("Frost Color", Color) = (1.0, 1.0, 1.0, 1.0)
_Mask ("Mask", Vector) = (1.0, 1.0, 1.0, 1.0)
}
SubShader {
Tags { "Queue"="Transparent" "RenderType"="Transparent" }
LOD 100
Pass {
Shader "Custom/FrostGL" {
Properties {
_MainTex ("Frost Map (RGB)", 2D) = "white" {}
_FrostColor ("Frost Color", Color) = (1.0, 1.0, 1.0, 1.0)
_Mask ("Mask", Vector) = (1.0, 1.0, 1.0, 1.0)
}
SubShader {
Tags { "Queue"="Transparent" "RenderType"="Transparent" }
LOD 100
Pass {