Skip to content

Instantly share code, notes, and snippets.

@Pyredrid
Pyredrid / GradientTextureDrawer.cs
Last active May 17, 2024 09:19
Gradient Texture Material Property Drawer
using UnityEngine;
using UnityEditor;
using System;
using System.Runtime.InteropServices;
/// <summary>
/// Use with "[GradientTexture]" before a texture shader property.
/// Gives a gradient editor instead of a texture selector when viewing
/// in the editor. Meaning you don't have to open any paint programs
/// to make gradient textures.
@Pyredrid
Pyredrid / MiscEditorTools.cs
Last active October 24, 2018 11:31
Does the most time-consuming task to do in Unity for you: Revert and apply large selections of prefabs (Something Unity does not have by default...)
//EDITOR SCRIPT
//Put in an Editor folder
using UnityEngine;
using UnityEditor;
public static class MiscEditorTools {
//Useful to revert changes to all selected prefab instances in the scene editor
[MenuItem("CustTools/Group Prefab Revert")]
public static void RevertGroup () {
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
public static class SunVoxWrapper {
private const string libPath = "sunvox";
static SunVoxWrapper () {
@Pyredrid
Pyredrid / SmoothLookAt.cs
Created September 7, 2016 18:36
A modified version of the SmoothLookAt script found on the Unity3D wiki: http://wiki.unity3d.com/index.php/SmoothLookAt_CS
using UnityEngine;
using System.Collections;
public class SmoothLookAt : MonoBehaviour {
public Transform target;
public float distance = 10.0f;
public float height = 5.0f;
//Animation curves to adjust the smoothing of
//the transform's overall movement
@Pyredrid
Pyredrid / color.py
Last active August 28, 2016 20:37
A python function to make rainbows with included example using BearLibTerminal
__author__='@pyredrid'
#Takes an angle from 0.0 to 1.0 (exclusive) and returns the
#corresponding color in ARGB from a color wheel with full alpha
def colorFromWheel(angle):
#Ensure that angle is positive
angle = abs(angle)
#Ensure that angle is between 0.0 and 1.0(exclusive)
#Uses repeating instead of clamping to
#allow time.time() rainbow tomfoolery