Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
public class #SCRIPTNAME# : MonoBehaviour
{
private void Awake ()
{
}
private void Update ()
@elringus
elringus / UIBlured.shader
Last active November 2, 2017 13:29
Blend mode and blur effect combined for UI objects.
// Blend mode and blur effect combined for UI objects.
Shader "BlendModes/Extra/UIBlured"
{
Properties
{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
_Color("Tint", Color) = (1,1,1,1)
_BlurRadius("Blur Radius", Range(1, 20)) = 7
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
public class SpriteChanger : MonoBehaviour
{
public List<Sprite> Sprites = new List<Sprite>();
public float ChangeRate = 2f;
private Image image;
@elringus
elringus / ReadOnlyAttribute.cs
Created June 29, 2017 14:06
ReadOnly property drawer for Unity: add a [ReadOnly] attribute to a serialized field to make it show up as read only in the inspector
// Put this outside of an 'Editor' folder.
using UnityEngine;
public class ReadOnlyAttribute : PropertyAttribute { }
using UnityEngine;
using System.Collections.Generic;
[System.Serializable]
public struct ColorMapping
{
public KeyCode KeyCode;
public Color Color;
}
using UnityEngine;
namespace BlendModes
{
[RequireComponent(typeof(BlendModeEffect))]
public class TintColorUpdater : MonoBehaviour
{
private BlendModeEffect blendModeEffect;
private void Awake ()
Shader "BlendModes/Extra/UIOverlay"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_OverlayTex1("Overlay Texture 1", 2D) = "white" {}
_OverlayTex2("Overlay Texture 2", 2D) = "white" {}
_OverlayTex3("Overlay Texture 3", 2D) = "white" {}
_OverlayTex4("Overlay Texture 4", 2D) = "white" {}
_OverlayTex5("Overlay Texture 5", 2D) = "white" {}
@elringus
elringus / NovelActorPerformance.cs
Created December 6, 2017 20:51
Promise aggregation
using UnityCommon;
/// <summary>
/// Represents a set of async actions performed by a <see cref="INovelActor"/> over time.
/// </summary>
public class NovelActorPerformance : AsyncAction<INovelActor>
{
public INovelActor Actor { get { return State; } }
private int performancesCount;
Shader "UI/Outline"
{
Properties
{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
_Color("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap("Pixel snap", Float) = 0
[Toggle]_IsOutlineEnabled("Enable Outline", int) = 0
[HDR]_OutlineColor("Outline Color", Color) = (1,1,1,1)
@elringus
elringus / SpriteGradientHSBC.shader
Last active January 8, 2018 11:12
Incorporates HSBC effects and gradient overlay blending for sprites.
// Incorporates HSBC effects and gradient overlay blending for sprites.
Shader "BlendModes/Extra/SpriteGradientHSBC"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_OverlayTex("Overlay Texture", 2D) = "white" {}
_OpacityTex("Opacity Mask", 2D) = "clear" {}