Skip to content

Instantly share code, notes, and snippets.

@elringus
elringus / SetTextureProperty.cs
Created January 15, 2022 08:40
Assign main texture property via the BlendModeEffect
using BlendModes;
using UnityEngine;
[RequireComponent(typeof(BlendModeEffect))]
public class SetTextureProperty : MonoBehaviour
{
public Texture2D Texture;
[ContextMenu("Set Texture")]
public void SetTexture ()
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
namespace Naninovel
@elringus
elringus / FileWatcher.cs
Last active November 1, 2024 05:53
Allows executing an editor behaviour in response to file modificatons, even when editor application is not in focus.
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Threading.Tasks;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
/// <summary>
/// Uses file system watcher to track changes to specific files in the project directory.
@elringus
elringus / Item.cs
Last active November 21, 2020 13:28
[System.Serializable]
public class Item
{
private string value = null;
public void SetValue (string value) => this.value = value;
public string GetValue () => value;
}
Shader "Custom/UnlitAlphaRotation"
{
Properties
{
_MainTex("Base (RGB) Trans (A)", 2D) = "white" {}
_RotationY("Rotation over Y-axis", Range(0, 360)) = 45
}
SubShader
@elringus
elringus / RenderMyCustomPass.cs
Last active September 27, 2024 03:44
Example for adding custom render passes via renderer features for lightweight render pipeline (LWRP)
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.LWRP;
// Inheriting from `ScriptableRendererFeature` will add it to the
// `Renderer Features` list of the custom LWRP renderer data asset.
public class RenderMyCustomPass : ScriptableRendererFeature
{
private class MyCustomPass : ScriptableRenderPass
{
@elringus
elringus / rfc5646-language-tags.js
Created December 14, 2018 17:14 — forked from msikma/rfc5646-language-tags.js
RFC 5646 Language Tags
// List of language tags according to RFC 5646.
// See <http://tools.ietf.org/html/rfc5646> for info on how to parse
// these language tags. Some duplicates have been removed.
var RFC5646_LANGUAGE_TAGS = {
'af': 'Afrikaans',
'af-ZA': 'Afrikaans (South Africa)',
'ar': 'Arabic',
'ar-AE': 'Arabic (U.A.E.)',
'ar-BH': 'Arabic (Bahrain)',
'ar-DZ': 'Arabic (Algeria)',
Shader "BlendOp"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
[Enum(UnityEngine.Rendering.BlendOp)] _BlendOp("Blend Operation", Float) = 0.0
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend("Source Blend", Float) = 1.0
[Enum(UnityEngine.Rendering.BlendMode)] _DstBlend("Destination Blend", Float) = 1.0
}
using UnityEngine.Tilemaps;
using BlendModes;
[ExtendedComponent(typeof(TilemapRenderer))]
public class TilemapRendererExtension : RendererExtension<TilemapRenderer>
{
public override string[] GetSupportedShaderFamilies ()
{
return new[] {
"SpritesDefault"
#if LIVE2D_AVAILABLE
using Live2D.Cubism.Core;
using Live2D.Cubism.Framework;
using System.Collections.Generic;
using System.Linq;
using UnityCommon;
using UnityEngine;
namespace Naninovel