Skip to content

Instantly share code, notes, and snippets.

@ruccho
ruccho / EmissiveDissolve.shader
Last active November 29, 2019 17:34
発光+ノイズによるディゾルブエフェクトを行うシェーダー。2D ピクセルパーフェクト対応。Bloomと一緒にお使いください。
Shader "Unlit/EmissiveDissolve"
{
Properties
{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
_Color("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap("Pixel snap", Float) = 0
[HideInInspector] _RendererColor("RendererColor", Color) = (1,1,1,1)
[HideInInspector] _Flip("Flip", Vector) = (1,1,1,1)
[PerRendererData] _AlphaTex("External Alpha", 2D) = "white" {}
@ruccho
ruccho / BG_DottedWave.shader
Created October 31, 2019 15:11
背景用シェーダー。Quadとかに貼ってつかってください。
Shader "Unlit/BG_DottedWave"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_UpperColor("Upper Color", Color) = (1.0,1.0,1.0,1.0)
_LowerColor("Lower Color", Color) = (1.0,1.0,1.0,1.0)
_SurfaceHeight("Surface Height", Float) = 0.5
@ruccho
ruccho / Fang Preview.lua
Last active February 1, 2020 08:40
A Lua script for Aseprite that shows auto tiling preview for FangAutoTile ( https://assetstore.unity.com/packages/tools/sprite-management/fang-auto-tile-132602 ).
----------------------------------------------------------------------
-- Auto tiling preview for FangAutoTile (https://assetstore.unity.com/packages/tools/sprite-management/fang-auto-tile-132602).
--
-- It works for all color modes (RGB/GRAY/INDEXED).
----------------------------------------------------------------------
if app.apiVersion < 1 then
return app.alert("This script requires Aseprite v1.2.10-beta3")
end
using System.Threading;
using UnityEngine;
public class FPSAdjuster : MonoBehaviour
{
[SerializeField, Min(1)]
private int fps;
[SerializeField]
private bool useThreadSleep = false;
@ruccho
ruccho / AutoVersion.cs
Last active May 3, 2020 04:40
Unityで再生ボタンを押すたびにプロジェクトのバージョンを上げるスクリプト。Editorフォルダに入れて使ってください。
using UnityEditor;
using System.Linq;
namespace Ruccho.Utilities
{
public class AutoVersion
{
[InitializeOnLoadMethod]
private static void RegisterEditorIncrementEvent()
@ruccho
ruccho / PersistentSerializedProperty.cs
Last active June 1, 2020 07:31
SerializedPropertyに対して配列操作によるインデックスの変更を追跡し、データの同一性を確保するためのラッパークラス
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace Ruccho.Utilities
{
/// <summary>
@ruccho
ruccho / InsertPlayerLoopSample.cs
Last active January 6, 2024 08:53
PlayerLoopに任意の処理を挿入するヘルパークラスと使用サンプル
using UnityEngine;
using UnityEngine.LowLevel;
using UnityEngine.PlayerLoop;
public class InsertPlayerLoopSample
{
public struct SampleCustomUpdate{}
[RuntimeInitializeOnLoadMethod]
private static void RegisterCustomPlayerLoop()
@ruccho
ruccho / MaterialExposition.cs
Last active October 25, 2020 18:11
uGUI ImageとかのマテリアルパラメータをAnimatorで制御したいときにSerializeFieldに露出するのに便利なクラス。本体 (MaterialExposition.cs) と使用サンプル (MaterialExpositionSample.cs)
using System;
using UnityEngine;
namespace Ruccho.Utilities
{
public abstract class MaterialExposition<T> where T : IEquatable<T>
{
protected Material target = default;
private T tempValue = default;
private int propertyKey = default;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Ruccho.Utilities
{
public class LockerSubject
{
public bool IsLocked => Keys.Count > 0;
@ruccho
ruccho / PostProcessProfileExposition.cs
Last active May 29, 2021 07:57
PostProcessingStackのVolumeのパラメータをSerializeFieldとして露出し、Animatorなどで制御可能にするやつ
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
namespace Ruccho.Utilities
{
public abstract class PostProcessSettingsExposition
{
public abstract void Update(PostProcessProfile profile);