Skip to content

Instantly share code, notes, and snippets.

View nicloay's full-sized avatar
✌️

Nikolay nicloay

✌️
View GitHub Profile
@nicloay
nicloay / all_keys.input_binding
Created September 19, 2017 19:01
Defold all key bindings. You can quickly find required key and then use text mode to add one
key_trigger {
input: KEY_SPACE
action: "space"
}
key_trigger {
input: KEY_EXCLAIM
action: "exclaim"
}
key_trigger {
input: KEY_QUOTEDBL
@nicloay
nicloay / Test.cs
Last active September 6, 2017 12:21
using System;
using UnityEngine;
using UnityEngine.Events;
public class Test : MonoBehaviour
{
public UnityEvent Event;
public Action CustomAction;
void Update()
@nicloay
nicloay / PaletteLoader.cs
Last active August 29, 2017 10:55
Load palette to the unity editor
using System;
using UnityEngine;
using System.Xml;
using UnityEditor;
/// <summary>
/// http://paletton.com
/// Save as xml
/// In UnityColor picker create new palette and save it to the project editor
@nicloay
nicloay / ConvertSerializationVersion.cs
Last active August 15, 2017 14:04 — forked from Seneral/ConvertSerializationVersion.cs
Script to convert files serialized in 5.5 to previous unity versions based on the text format.
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
public static class ConvertSerializationVersion
{
private static Regex objectIDSearch = new Regex("--- !u!(?:[0-9]{1,5}) &([0-9]*)");
@nicloay
nicloay / Singleton.cs
Last active February 2, 2018 08:44
Unity3d singleton
using UnityEngine;
public class Singleton<T> : MonoBehaviour where T : MonoBehaviour
{
static T _instance;
static readonly object _lock = new object();
public static bool Initialized()
{
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class VKPhotoAlbumUploader
{
public const int ERROR_VK_INIT_PROBLEM = 251;
public const int ERROR_VK_INIT_TIMEOUT = 252;
public string AlbumName = "TestAlbum";
public int ErrorCode { get; private set; }
@nicloay
nicloay / TexturePathPropertyDrawer.cs
Created May 29, 2017 08:03
Save texture as a relative to Resources folder link
using System;
using UnityEngine;
using UnityEditor;
using PaintCraft.Utils;
using System.IO;
using System.Linq;
namespace PaintCraft.Editor{
[CustomPropertyDrawer(typeof(TexturePathAttribute))]
@nicloay
nicloay / RandomColor.cs
Created May 24, 2017 11:55
pseudo random color using encryptor (get unique color with id)
using UnityEngine;
using System.Security.Cryptography;
using System.IO;
using System;
using UnityEditor;
public class RandomColor {
uint autoColorId;
RijndaelManaged rijAlg;
public RandomColor(){
// /**
// * Easing equation float for a circular (sqrt(1-t^2)) easing out: decelerating from zero velocity.
// *
// * @param t Current time (in frames or seconds).
// * @param b Starting value.
// * @param c Change needed in value.
// * @param d Expected easing duration (in frames or seconds).
// * @return The correct value.
// */
// public static float EaseOutCirc (float t, float b, float c, float d) {
@nicloay
nicloay / ColorSequenceGenerator.cs
Created May 16, 2017 12:41
Generate sequence of colors which are visually recognizable as different
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ColorSequenceGenerator {
static int[] sequence = new int[]{0, 21, 3, 18, 6, 15, 9, 12};
static Color32 GetColor(int colorId){