Skip to content

Instantly share code, notes, and snippets.

View mandarinx's full-sized avatar

Thomas Viktil mandarinx

View GitHub Profile
// threshold for mask can be controlled using vertex color alpha (useful for spriteRenderers or particle systems)
// _MainTex: alpha of this texture is used as a mask
// _EmissionTex: usually rgb noise texture, adjust it's scaling if needed
// color remap and oscilation for each channel of emission can be modified in _EmStrobeBFALR, _EmStrobeBFALG, _EmStrobeBFALB
// Base: base amplitude of brightness oscilation
// Freq: frequency of oscilation
// Ampl: amplitude of oscilation
// L: how much _EmissionTex affects this color
Shader "StandardWMask" {
@LotteMakesStuff
LotteMakesStuff / 1.md
Last active June 30, 2025 09:30
UPM: How to make a custom package

UPM: How to make a custom package So, Unity has this shiny new package manager, and you have code you want to share between projects - wouldn't it be great if we could bundle up our shared code and plug it into all the projects that need it? Let's figure out how to make our own Package!


Todo

  • Modify the project manifest
  • Make a package manifest
  • Package the manifest up with some test code
  • Try it out in Unity!

@bugshake
bugshake / Screenshotter.cs
Created February 21, 2018 15:55
Save a screenshot in any resolution from the Unity Editor. Useful for making screenshots higher than your monitor's resolution.
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEditor;
/*
AUTHOR: Stijn Raaijmakers @bugshake
// c# companion script
// SpriteUVToShader.cs -------------------------------------------------------------------------------------------------------------------------------- //
// Save you your project, add to your SpriteRenderer gameObject
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[ExecuteInEditMode]
@LotteMakesStuff
LotteMakesStuff / MinMaxAttribute.cs
Last active August 12, 2025 17:41
MinMax property drawer for Unity - Add a [MinMax] attribute to a property to draw a useful min/max setting slider.
// NOTE DONT put in an editor folder
using UnityEngine;
public class MinMaxAttribute : PropertyAttribute
{
public float MinLimit = 0;
public float MaxLimit = 1;
public bool ShowEditRange;
public bool ShowDebugValues;
@idbrii
idbrii / botw-cedec2017.md
Last active June 13, 2025 15:20
An inline image version of Matt Walker's translation of CEDEC 2017 talks by Nintendo
@JohannesDeml
JohannesDeml / EditPrefabInScene.cs
Last active May 17, 2023 04:40 — forked from ulrikdamm/EditPrefab.cs
Unity editor script for better editing of prefabs. Put in Assets/Editor.
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
// From https://gist.github.com/JohannesDeml/5802473b569718c9c86de906b7039aec
// Original https://gist.github.com/ulrikdamm/338392c3b0900de225ec6dd10864cab4
// Adds a "Edit Prefab" option in the Assets menu (or right clicking an asset in the project browser).
// This opens an empty scene with your prefab where you can edit it.
// Put this script in your project as Assets/Editor/EditPrefab.cs
@PopupAsylumUK
PopupAsylumUK / ShadowMeshBatcher.cs
Last active April 12, 2017 13:52
A script that finds meshes in the scene that could probably all be rendered as a single shadow caster and creates a moderately optimized mesh or meshes for shadow rendering. The resulting meshes should be cast shadows only, and the meshes they represent/replace should not cast shadows.
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class ShadowMeshBatcher : EditorWindow {
[MenuItem("Window/Shadow Mesh Batcher")]
static void Init() {
// Get existing open window or if none, make a new one:
@ffyhlkain
ffyhlkain / ReferenceFinder.cs
Last active February 19, 2025 05:48
A reference finder for assets in a #Unity3d project.
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using UnityEditor;
using UnityEngine;
using Debug = UnityEngine.Debug;
using Object = UnityEngine.Object;
namespace FoundationEditor.Editor.ReferenceFinder
{
@bugshake
bugshake / ReadableID
Created February 22, 2017 15:21
Translate a unique ID into something human readable/recognizable/discernable
public static class ReadableID
{
static readonly string[] syllables = new string[256];
public static void initOnce()
{
string[] consonants = new string[] { "b", "br", "c", "ch", "d", "f", "fr", "g", "h", "j", "k", "kn", "l", "m", "n", "p", "pr", "qu", "r", "s", "st", "sl", "sc", "t", "tr", "v", "w", "x", "z" };
string[] vowels = new string[] { "a", "e", "i", "o", "u", "y", "ae", "ee", "ea", "ai" };
for (int i = 0; i < syllables.Length; ++i)
{