Skip to content

Instantly share code, notes, and snippets.

@phosphoer
phosphoer / BuildDefinition.cs
Last active May 17, 2021 09:06
Create build definition assets in Unity and build multiple platforms / builds with different scenes at once with the click of a button!
// The MIT License (MIT)
// Copyright (c) 2017 David Evans @phosphoer
// 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:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
@aras-p
aras-p / SceneViewShowMips.shader
Last active July 2, 2021 07:51
Unity editor scene view "show mips" shader (as it is in 5.6 alpha)
/* C# code that sets up the mip colors texture:
s_MipColorsTexture = new Texture2D (32, 32, TextureFormat.RGBA32, true);
s_MipColorsTexture.hideFlags = HideFlags.HideAndDontSave;
Color[] colors = new Color[6];
colors[0] = new Color (0.0f, 0.0f, 1.0f, 0.8f);
colors[1] = new Color (0.0f, 0.5f, 1.0f, 0.4f);
colors[2] = new Color (1.0f, 1.0f, 1.0f, 0.0f); // optimal level
colors[3] = new Color (1.0f, 0.7f, 0.0f, 0.2f);
colors[4] = new Color (1.0f, 0.3f, 0.0f, 0.6f);
colors[5] = new Color (1.0f, 0.0f, 0.0f, 0.8f);
@SoylentGraham
SoylentGraham / PaintCloudData.shader
Created May 3, 2016 22:31
Shader based texture painting. Add the script to a plane with a collider and attach a render texture
Shader "NewChromantics/PaintCloudData"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
PaintUv("PaintUv", VECTOR) = (0,0,0,0)
PaintBrushSize("PaintBrushSize", Range(0,0.1) ) = 0.1
}
SubShader
{
@tpodhraski
tpodhraski / ComponentConstraint.as
Created September 26, 2012 22:50
Constrained Layout
package justpinegames
{
public class ComponentConstraint
{
public static const HORIZONTAL_CONSTRAINT_LEFT:String = "left";
public static const HORIZONTAL_CONSTRAINT_CENTER:String = "center";
public static const HORIZONTAL_CONSTRAINT_RIGHT:String = "right";
public static const VERTICAL_CONSTRAINT_TOP:String = "top";
public static const VERTICAL_CONSTRAINT_MIDDLE:String = "middle";
public static const VERTICAL_CONSTRAINT_BOTTOM:String = "bottom";
@alebianco
alebianco / MyDirtyConfig.as
Created September 8, 2012 14:49
Robotlegs & Flex: automediate popups
package
{
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import mx.core.IUIComponent;
import mx.managers.ISystemManager;
import robotlegs.bender.extensions.mediatorMap.api.IMediatorMap;
import robotlegs.bender.extensions.viewManager.api.IViewManager;
@cuppster
cuppster / 1.cs
Created September 3, 2012 18:39
Promises for C# using Generics
/*
modified from original source: https://bitbucket.org/mattkotsenas/c-promises/overview
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Promises
@vrobel
vrobel / StateSystemRules.as
Created July 24, 2012 19:18
SystemEnabledRule
package com.blackmoondev.ashes.boot.vo
{
import net.richardlord.ash.core.Game;
import net.richardlord.ash.core.SystemEnabledRule;
import org.hamcrest.Matcher;
import org.hamcrest.collection.inArray;
import org.hamcrest.core.not;
import org.hamcrest.object.equalTo;
@flarb
flarb / AssetGPULoader.cs
Created July 22, 2012 19:06
Unity3d GPU Pre-loader
using UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;
public class AssetGPULoader : MonoBehaviour {
public Camera activeCamera;
RenderTexture _rt;
package org.devboy;
import haxe.macro.Type;
import neko.Lib;
import haxe.macro.Expr;
import haxe.macro.Context;
class Funk
{