Skip to content

Instantly share code, notes, and snippets.

View arkms's full-sized avatar
👨‍💻
Coding... 01101000 01100101 01101100 01101100 01101111

arkms

👨‍💻
Coding... 01101000 01100101 01101100 01101100 01101111
View GitHub Profile
@arkms
arkms / ShortCutKeys.cs
Last active June 7, 2019 12:40
Add to Unity the possibility to PLAY with just F6 and PAUSA with F7. Just download the script and put inside the "Editor" folder.
namespace Arj2D
{
public class ShortCutKeys
{
private const string MENU_EXTRA_RUN = "Edit/Extra/Run _F6";
private const string MENU_EXTRA_PAUSE = "Edit/Extra/Run _F7";
[MenuItem(MENU_EXTRA_RUN)]
private static void Run()
{
@arkms
arkms / DebugLogEmail.cs
Created January 24, 2019 21:41
Unity: Enviar Logs de consola por email para ejecutables de PC, Mac, Linux, Android, iOS, AppleTV y WebGL.
using System.Collections;
using System.Text;
using UnityEngine;
public class DebugLogEmail : MonoBehaviour
{
//Llamar desde un boton o presionar una tecla para enviar los logs por email
public void MandarEmail()
{
StartCoroutine(SendData());
@arkms
arkms / CombineTexture.cs
Created November 2, 2018 20:54
Unity: Combine two textures in one, basic in TextureA copy TextureB
Texture2D CombineTexutes(Texture2D _textureA, Texture2D _textureB)
{
//Create new textures
Texture2D textureResult = new Texture2D(_textureA.width, _textureA.height);
//create clone form texture
textureResult.SetPixels(_textureA.GetPixels());
//Now copy texture B in texutre A
for (int x = 0; x<_textureB.width; x++)
{
for (int y = 0; y<_textureB.height; y++)
@arkms
arkms / TextureToNormalmap.cs
Created February 1, 2018 00:29
Obtener el NormalMap de un Texture2D en runtime
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//Basado en: https://forum.unity.com/threads/bumpmap-grayscale-to-normalmap-rgb.5714/
public class TextureToNormalmap : MonoBehaviour
{
//---CODIGO DE EJEMPLO------------------------------
public Texture2D textura;
[Range(10f, 20f)]
@arkms
arkms / UI_HoldButton.cs
Created October 11, 2017 23:03
Permite agregarle a un botón la posibilidad de llamar una función mientras se mantenga presionado.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
public class UI_HoldButton : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
public UnityEvent OnHold;
@arkms
arkms / SpriteToTexture.cs
Last active November 2, 2017 18:07
Guardar todos los sprites de una textura recortados dentro de la herramienta de Unity como imagenes separadas png para usarlo en otra herramienta
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;
public class SpriteToTexture : EditorWindow
{
private Texture2D Atlas;
@arkms
arkms / ConstantsGeneratorKit.cs
Created June 7, 2017 18:06
Script que automáticamente genera otros scripts que tiene los Tags, Layers y Sorting Layers del proyecto para trabajar con ellos en un script de manera sencilla, simplemente se debe actualizar llamando 'Edit/Generate Constants Classes'
using UnityEngine;
using UnityEditor;
using System;
using System.Text.RegularExpressions;
using System.IO;
using System.Linq;
using System.Reflection;
//Basado en codigo de Prime31Editor
//Poner siempre este script dentro de una carpeta llamado 'Editor'
@arkms
arkms / ResourcesCheckConflict.cs
Created May 10, 2017 18:59
A simple script that check if exist some conflict with all Resources folders in project. For use it just go to ' Window/ResourcesCheckConflict '
//This script put inside a Folder with the name 'Editor'
//Developer by ARKMs , use it with total liberty
using UnityEngine;
using UnityEditor;
using System;
using System.IO;
using System.Collections.Generic;
@arkms
arkms / SaveData.cs
Created March 3, 2017 05:15
A easy and fast way to save a lot of vars in Unity
using UnityEngine;
public class SaveData : MonoBehaviour
{
public SAVEDATACLASS progreso; //es visible desde Inspector
public void Guardar()
{
//Generamos el formato Json
string Archivo = JsonUtility.ToJson(progreso);
@arkms
arkms / RielesLerp
Created November 8, 2016 06:20
Rieles con Lerp
public float Velocidad;
public Transform[] Puntos;
//Internos
int IndexActual = 0; //Index para mover en puntos
Vector3 PuntoA; //Punto A para Lerp
Vector3 PuntoB; //Punto B para Lerp
float t; //Factor tiempo de Lerp
float factorT; //Factor de moviemnto