Skip to content

Instantly share code, notes, and snippets.

View atori708's full-sized avatar

Atori708 atori708

  • JPN
View GitHub Profile
@atori708
atori708 / 0_reuse_code.js
Created May 19, 2016 09:59
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@atori708
atori708 / BackFrontAsTwoPath.shader
Created November 12, 2017 08:03
表面と裏面で描画を変えるUnityのシェーダコード 2パスで描画版とVFACEセマンティクス使った板
Shader "Unlit/TwoPasses"
{
Properties
{
_FrontColor("Front Color", Color) = (1,1,1,1)
_BackColor("Back Color", Color) = (1,1,1,1)
}
SubShader
{
Tags { "RenderType"="Opaque" }
@atori708
atori708 / VertexColorTransparent.shader
Created December 23, 2017 22:28
頂点カラーを使った透過処理 for Unity
Shader "Custom/VertexColorTransparent"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 100
@atori708
atori708 / Transition.shader
Created March 2, 2018 14:58
uGUI Transition Shader
Shader "UI/Cunstom/transition"
{
Properties
{
// Set from "source image" in Image component.
[HideInInspector]_MainTex ("Texture", 2D) = "white" {}
_Edge ("Edge", Range(0, 1)) = 0.01
_Progress ("Progress", Range(0, 1)) = 0
}
SubShader
@atori708
atori708 / RedoShortcut.cs
Created March 4, 2018 06:07
Unity's other Redo shortcut(ctrl+shift+Z) on windows.
using UnityEngine;
using UnityEditor;
public static class MyShortcuts {
[MenuItem("Edit/Redo %#Z")]
static void Redo() {
Undo.PerformRedo ();
}
}
@atori708
atori708 / StringExtension.cs
Created March 4, 2018 11:16
String extension methods for Unity Richtext. Color, Size, Bold and Italic.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Extension methods for string.
/// </summary>
public static class StringExtension{
public static string Bold(this string str)
{
@atori708
atori708 / RedoShortcutKey.cs
Last active March 9, 2018 16:18
Redo shortcut key for Unity on Windows. You have to put in Editor directory.
using UnityEditor;
public static class RedoShortcutKey {
[MenuItem("Edit/Redo %#Z")]
static void Redo() {
Undo.PerformRedo ();
}
}
@atori708
atori708 / InvertColor.shader
Last active July 6, 2023 10:10
It's invert color post process shader for Unity.(Use ImageEffect or uGUI's Image)
Shader "Custom/InvertColor"
{
// Propertiesはいらなくなる / Properties is unnecessary.
SubShader {
Tags {"Queue" = "Transparent+10000"} // RenderQueueは最後になるようにとにかくでかく / Set biggest value in your scene.
GrabPass{} // 追加 / To add
Pass {
@atori708
atori708 / RingArray.cs
Last active March 31, 2018 12:35
環状配列(要素数は2のべき乗)。通常の配列の使い方が出来るが、先頭と末尾が環状になってるので要素数がオーバーフローしない。作ったけど用途がないので供養(チーン)
/// <summary>
/// 環状配列
/// 2のべき乗でしか作れない
/// スレッドセーフではない
/// </summary>
public class RingArray<T> : System.Collections.ICollection
{
T[] buffer;
int top, bottom;
int mask;
@atori708
atori708 / TimelinePlayHeadTest.cs
Last active January 1, 2022 10:06
【Unity】Timeline側に仕込んだイベントをフックする
using System;
using System.Reflection;
using UnityEngine;
using UnityEditor.Timeline;
public class TimelinePlayHeadTest : MonoBehaviour
{
System.Object timelineWindowObj;
EventInfo onChangedPlayHead;
Delegate changedPlayHeadHandlerDelegate;