Skip to content

Instantly share code, notes, and snippets.

View frarees's full-sized avatar

Francisco Requena frarees

View GitHub Profile
@frarees
frarees / MiniJSON.cs
Created November 13, 2012 15:07 — forked from darktable/MiniJSON.cs
Unity3D: MiniJSON Decodes and encodes simple JSON strings. Not intended for use with massive JSON strings, probably < 32k preferred. Handy for parsing JSON from inside Unity3d.
/*
* Copyright (c) 2012 Calvin Rien
*
* Based on the JSON parser by Patrick van Bergen
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
*
* Simplified it so that it doesn't throw exceptions
* and can be used in Unity iPhone with maximum code stripping.
*
* Permission is hereby granted, free of charge, to any person obtaining
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
public class ComponentLister : EditorWindow {
using UnityEngine;
using System.Collections;
using UnityEditor;
using System;
using System.Reflection;
using System.Linq;
[InitializeOnLoad] //Make sure this code runs every time the editor is updated
public class MagicInspectors : EditorWindow {
@frarees
frarees / MacroKiller.cs
Last active December 8, 2023 10:30
Evaluate C# code on editor for Unity3D
// https://frarees.github.io/default-gist-license
using System.IO;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using Microsoft.CSharp;
using System.CodeDom.Compiler;
@frarees
frarees / Grid.shader
Created January 4, 2014 17:53
Unity3D compatible CG shader to use with an orthographic projector to create a square grid.
Shader "Projector/Grid" {
Properties {
_Color ("Color", Color) = (1,1,1,0)
_ShadowTex ("Cookie", 2D) = "black"
_Size ("Grid Size", Float) = 1
}
Subshader {
Tags { "RenderType"="Transparent" "Queue"="Transparent+100" }
@frarees
frarees / MinMaxSliderAttribute.cs
Last active April 4, 2024 12:13
MinMaxSlider for Unity
// https://frarees.github.io/default-gist-license
using System;
using UnityEngine;
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public class MinMaxSliderAttribute : PropertyAttribute
{
public float Min { get; set; }
public float Max { get; set; }
@frarees
frarees / New.cs
Created October 7, 2014 13:38
Class Layout Update on Unity3D
using UnityEngine;
using System.Collections;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class Test : MonoBehaviour, ISerializationCallbackReceiver {
[SerializeField, HideInInspector] int m_SerializedVersion;
[SerializeField] string m_NewString;
@frarees
frarees / Interfaces.cs
Last active August 29, 2015 14:08
Unity Serialization & Interfaces
// I'd like to serialize the GetComponents result straight away when getting components via interface
// That would avoid allocating more memory for another list that can be serialized
// signature: void GetComponents<T, K> (List<T> result) where T : Component;
public class MyBehaviour : MonoBehaviour, ICustom {
List<MonoBehaviour> behaviours = new List<MonoBehaviour> ();
void Awake () {
GetComponents<MonoBehaviour, ICustom> (behaviours);
@frarees
frarees / ColliderMask.cs
Created March 8, 2015 15:35
Filter canvas raycasts with Collider2D data (Unity3D)
using UnityEngine;
using UnityEngine.UI;
[RequireComponent (typeof (Image), typeof (Collider2D))]
public class ColliderMask : MonoBehaviour, ICanvasRaycastFilter {
Image m_Image;
Collider2D m_Collider;
void Awake () {
@frarees
frarees / raspi-sd-benchmarks.md
Last active May 1, 2020 12:59
Raspberry Pi SD card benchmark