Skip to content

Instantly share code, notes, and snippets.

@ruccho
ruccho / PbdStrip.cs
Created January 8, 2024 10:03
2D small-step XPBD strip implementation with bending constraint for Unity.
using System.Runtime.InteropServices;
using System.Threading;
using Unity.Burst;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
namespace Spring2D
{
@ruccho
ruccho / C932_net6.html
Created October 1, 2022 14:27
Shift_JIS table in Unity / .Net Framework 4.8 / .NET 6
<!DOCTYPE html>
<html>
<body>
<table>
<tr>
<th></th>
<th>0</th>
<th>1</th>
<th>2</th>
@ruccho
ruccho / InstAnime.cs
Last active March 12, 2022 07:33
UniTaskベースのコンパクトなアニメーションライブラリ。工事中
using System;
using System.Threading;
using Cysharp.Threading.Tasks;
using Cysharp.Threading.Tasks.Triggers;
using UnityEngine;
using UnityEngine.UI;
namespace InstAnime
{
public abstract class InstantAnimator : IDisposable
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
namespace Ruccho.Utilities
{
public abstract class VolumeProfileExposition
{
public abstract void Update(VolumeProfile profile);
@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);
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Ruccho.Utilities
{
public class LockerSubject
{
public bool IsLocked => Keys.Count > 0;
@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;
@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 / 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 / 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()