Skip to content

Instantly share code, notes, and snippets.

@drZool
drZool / LerpHelper.cs
Last active April 21, 2018 08:40
This is a utility to lerp stuff over time. Feed in the time and you get normalized time and or a value of the current custom lerp.
using System;
using System.Collections;
using UnityEngine;
public struct LerpHelper<T>
{
public T from;
public T to;
public float duration;
public float start;
@drZool
drZool / IosPostBuild.cs
Created December 15, 2016 07:35
Prior 5.2.2p1 ios build would fail upload to testflight/appstore if info.plist did not have UIRequiresFullScreen = true. This fixes that
using System.IO;
using UnityEngine;
using UnityEditor;
using System.Collections;
using UnityEditor.Callbacks;
#if UNITY_IOS
using UnityEditor.iOS.Xcode;
#endif
@drZool
drZool / ObjectSpacing.cs
Last active October 29, 2019 16:43
Tool for aligning and distribute objects, primarly in 2d space, can be extended to 3d
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.Collections.Generic;
/// <summary>
/// Tool for spacing objects, primarly in 2d space, can be extended to 3d
/// </summary>
public class ObjectSpacing : EditorWindow
{
@drZool
drZool / DelayedAction.cs
Last active October 29, 2019 16:42
Delay actions. Keeps all actions in a sorted list to minimize overhead.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
/// <summary>
///
/// Delay actions. Keeps all actions in a sorted list to minimize overhead.
///
/// </summary>
@drZool
drZool / GroupSceneObjects.cs
Last active May 7, 2019 11:00
Group selected scene objects. Place this script below a folder named "Editor"
using UnityEngine;
using System.Collections;
using UnityEditor;
public class GroupSceneObjects
{
[MenuItem("Hello/GroupSelected %g")]
static void GroupSelected(){
Transform topParent = null;
@drZool
drZool / ProjectFileMod.cs
Last active March 20, 2017 14:07
Asset post processor to change .NET framework version from 3.5 to 4. and possibly mark the projects as unsafe.
//#define ALLOW_UNSAFE //Uncomment this if you need to be in unsafe mode
using System.IO;
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Text.RegularExpressions;
class ProjectFileMod : AssetPostprocessor
{
@drZool
drZool / CameraListEditor.cs
Created April 11, 2017 13:01
List cameras
using UnityEditor;
using System.Collections.Generic;
using UnityEngine;
public class CameraListEditor : EditorWindow
{
private List<Camera> cameras = new List<Camera>();
[MenuItem("Hello/Scene/Camera List")]
public static void Init()
@drZool
drZool / Pool.cs
Last active June 24, 2019 08:48
A pool that gets unloaded if the scene is unloaded.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Pool : MonoBehaviour
{
static Pool instance;
static public Pool Instance
{
@drZool
drZool / Graph.cs
Last active April 27, 2017 13:56
Write a graph to a texture
/*
Write a graph to a texture
Usage:
void Start(){
graph = new Graph (512, 256, new Color[]{ Color.red, Color.green, Color.blue });
graphRenderer.material.mainTexture = graph.texture;
}
void Update(){
@drZool
drZool / TerrainTexturing.cs
Created May 26, 2017 13:38
Auto texture terrain based on steepness and existing textures
using UnityEngine;
using System.Collections;
using UnityEditor;
public class TerrainTexturing : EditorWindow
{
[MenuItem ("Hello/Terrain/Texturing")]
static void OpenEditor ()
{
EditorWindow.GetWindow<TerrainTexturing> ();