Skip to content

Instantly share code, notes, and snippets.

View Adjuvant's full-sized avatar

Adjuvant

View GitHub Profile
@scho
scho / IView.cs
Last active July 17, 2025 15:05
Minimalistic MVVM for Unity, UI Toolkit and UniRX
using System;
using UnityEngine.UIElements;
namespace ProjectHive.UI.UI
{
public interface IView<in TViewModel> : IView
{
IDisposable Bind(TViewModel viewModel);
}
@scho
scho / UiToolkitBindingExtensions.cs
Last active July 17, 2025 15:05
UI Toolkit Reactive Binding Extensions using UniRx
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using JetBrains.Annotations;
using ProjectHive.Core.Util.UniRx;
using UniRx;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Video;
@GCodergr
GCodergr / UnityUIExtensions.cs
Last active November 27, 2022 16:54
UniRx SubscribeToText support for TextMeshPro
using System;
using TMPro;
namespace UniRx.Extensions
{
public static class UnityUIExtensions
{
public static IDisposable SubscribeToText(this IObservable<string> source, TextMeshProUGUI text)
{
return source.SubscribeWithState(text, (x, t) => t.text = x);
@DashW
DashW / PlayableVideoAsset.cs
Created October 24, 2018 15:46
Scrubbable Video Player Track for Unity Timeline
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Video;
public class PlayableVideoAsset : PlayableAsset
{
public ExposedReference<VideoClip> Clip = new ExposedReference<VideoClip>();
public float Offset;
private double _duration;
/*
Copyright (c) 2018 Pete Michaud, github.com/PeteMichaud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@keijiro
keijiro / template.glsl
Last active November 13, 2022 19:13
KodeLife Fragment Shader Template
#version 150
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
uniform vec3 spectrum;
uniform sampler2D texture0;
uniform sampler2D texture1;
uniform sampler2D texture2;
uniform sampler2D texture3;
@ManuelTS
ManuelTS / SaveLoadWav.cs
Created February 5, 2018 11:11
Saves and loads in Unity .wav files in the Application.persistentDataPath
/* Copyright (c) 2018 Manuel T. Schrempf
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:
@nemotoo
nemotoo / .gitattributes
Last active December 2, 2025 14:40
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@gering
gering / Toolkit
Last active July 11, 2024 14:05
persitent data path handling in Unity with fallback
private static string[] _persistentDataPaths;
public static bool IsDirectoryWritable(string path) {
try {
if (!Directory.Exists(path)) return false;
string file = Path.Combine(path, Path.GetRandomFileName());
using (FileStream fs = File.Create(file, 1)) {}
File.Delete(file);
return true;
} catch {
///
/// Simple pooling for Unity.
/// Author: Martin "quill18" Glaude (quill18@quill18.com)
/// Latest Version: https://gist.github.com/quill18/5a7cfffae68892621267
/// License: CC0 (http://creativecommons.org/publicdomain/zero/1.0/)
/// UPDATES:
/// 2015-04-16: Changed Pool to use a Stack generic.
///
/// Usage:
///