This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Texture texture = new Texture2D(maximunAtlasSize, maximunAtlasSize); | |
texture.PackTextures(frames, padding, maximunAtlasSize); | |
texture.name = "New Atlas"; | |
texture.Apply(); | |
if(!Directory.Exists(Application.dataPath + "/Atlases")) | |
Directory.CreateDirectory(Application.dataPath + "/Atlases"); | |
FileStream fs = new FileStream(Application.dataPath + "/Atlases/" + texture.name + ".png", FileMode.Create); | |
BinaryWriter bw = new BinaryWriter(fs); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Original source | |
//http://lolengine.net/blog/2013/01/13/fast-rgb-to-hsv | |
//http://ploobs.com.br/?p=1499 | |
#ifndef RGBA2HSVA | |
#define RGBA2HSVA | |
fixed4 RGBA2HSVA(fixed4 rgba) | |
{ | |
float K = 0; | |
fixed temp; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Source http://forum.unity3d.com/threads/free-photoshop-blends.121661/ | |
#ifndef AUB_BLENDS_INCLUDED | |
#define AUB_BLENDS_INCLUDED | |
/**********************INCLUDES**********************/ | |
/**********************STRUCTS**********************/ | |
struct a2f_uv0 { | |
float4 vertex : POSITION; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//originally adopted from | |
//http://answers.unity3d.com/questions/447701/event-for-unity-editor-pause-and-playstop-events.html | |
//with a few modifications which makes the event firing nicer and cleaner | |
//Usage Example : | |
// | |
//using UnityEditor; | |
//using UnityEngine; | |
// | |
//[InitializeOnLoad] | |
//public class SingleEntryPoint |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.Reflection; | |
using System; | |
using UnityEditorInternal; | |
[CustomEditor(typeof(MeshRenderer)), CanEditMultipleObjects] | |
public class MeshRendererInspector : Editor | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System; | |
public class QueuedTask : Singleton<QueuedTask> { | |
const int MaxProcessCount = 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///Sync camera position between scene camera and the rendering camera | |
//Add [ExecuteInEditorMode] to your monobehaviour and add the following OnRenderObject method as well. | |
///... | |
[ExecuteInEditorMode] | |
//... | |
void OnRenderObject () { | |
cam = Camera.current; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
/* | |
* Functions taken from Tween.js - Licensed under the MIT license | |
* at https://github.com/sole/tween.js | |
*/ | |
public class Easing | |
{ | |
public static float Linear (float k) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void DrawString(Camera cam,string text, Vector3 worldPos, Color? colour = null) | |
{ | |
if (IsValidCamera (cam) == false) | |
return; | |
UnityEditor.Handles.BeginGUI(); | |
Color c = GUI.color; | |
if (colour.HasValue) GUI.color = colour.Value; | |
var view = UnityEditor.SceneView.currentDrawingSceneView; | |
if (view==null) return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
public class GameEvent | |
{ | |
} | |
public class Events | |
{ | |
static Events instanceInternal = null; |
OlderNewer