Skip to content

Instantly share code, notes, and snippets.

@belzecue
belzecue / ExampleBehavior.cs
Created April 13, 2019 15:55 — forked from ProGM/ExampleBehavior.cs
A PropertyDrawer to show a popup field with a generic list of string for your Unity3d attribute
public class MyBehavior : MonoBehaviour {
// This will store the string value
[StringInList("Cat", "Dog")] public string Animal;
// This will store the index of the array value
[StringInList("John", "Jack", "Jim")] public int PersonID;
// Showing a list of loaded scenes
[StringInList(typeof(PropertyDrawersHelper), "AllSceneNames")] public string SceneName;
}
@belzecue
belzecue / SavWav.cs
Last active April 19, 2019 11:10 — forked from darktable/SavWav.cs
Unity3D: script to save an AudioClip as a .wav file.
// Copyright (c) 2012 Calvin Rien
// http://the.darktable.com
//
// This software is provided 'as-is', without any express or implied warranty. In
// no event will the authors be held liable for any damages arising from the use
// of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
@belzecue
belzecue / ToonMotion.cs
Created April 23, 2019 06:15 — forked from mnogue/ToonMotion.cs
Custom frame-per-second 3D animations for Unity3D. Based on Spider-Man: Into the Spider-Verse movie
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ToonMotion : MonoBehaviour
{
private class Snapshot
{
public Transform transform;
public Vector3 position;
@belzecue
belzecue / Grid shader
Last active December 16, 2021 22:03 — forked from slipster216/Grid shader
// Originally written by Jason Booth https://gist.github.com/slipster216/3eec15c240066277e69e065a90e1f9fe
// Updated by Andrew Ferguson, April 2019.
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Custom/GridShader" {
Properties
{
@belzecue
belzecue / UnityShaderFFS.md
Created April 27, 2019 12:37 — forked from smkplus/UnityShaderCheatSheet.md
Controlling fixed function states from materials/scripts in Unity

16999105_467532653370479_4085466863356780898_n

Shader "MaterialPropertyDrawer"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
 
[HideInInspector] _MainTex2("Hide Texture", 2D) = "white" {}
@belzecue
belzecue / SimpleInkPaint.cs
Created April 27, 2019 13:42
Unity Simple Ink Paint Script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//-------------------------------------
// simple ink paintスクリプト
// ColliderとRendererは必要
[RequireComponent(typeof(Renderer))]
[RequireComponent(typeof(Collider))]
public class SimpleInkPaint : MonoBehaviour {
@belzecue
belzecue / SimpleInkPaint.shader
Created April 27, 2019 13:43
Unity Simple Ink Paint Shader
Shader "Unlit/SimpleInkPaint"
{
Properties{
_MainTex("MainTex", 2D) = "white" // メインテクスチャ
_Brush("Brush", 2D) = "white" // ブラシテクスチャ
_BrushScale("BrushScale", FLOAT) = 0.1 // ブラシサイズ
_ControlColor("ControlColor", VECTOR) = (0, 0, 0, 0) // ブラシの色
_PaintUV("Hit UV Position", VECTOR) = (0, 0, 0, 0) // ブラシで塗りたい位置
}
@belzecue
belzecue / ColorRotator.cs
Created April 27, 2019 15:33
Unity Tip #1: Color.HSVToRGB(h, s, v) produces smoother, more natural random colors than new Color(r, g, b)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ColorRotator : MonoBehaviour {
public GameObject objHSV, objPlainColor;
private Material objHSVMaterial, objPlainColorMaterial;
private float timeDelta;
@belzecue
belzecue / ColorRotator.cs
Created April 27, 2019 15:33
Unity Tip #1: Color.HSVToRGB(h, s, v) produces smoother, more natural random colors than new Color(r, g, b)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ColorRotator : MonoBehaviour {
public GameObject objHSV, objPlainColor;
private Material objHSVMaterial, objPlainColorMaterial;
private float timeDelta;
@belzecue
belzecue / ColorRotator.cs
Last active October 12, 2022 22:13
Unity3D Tip #1: Color.HSVToRGB(h, s, v) produces smoother, more natural random colors than new Color(r, g, b)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ColorRotator : MonoBehaviour {
public GameObject objHSV, objPlainColor;
private Material objHSVMaterial, objPlainColorMaterial;
private float timeDelta;