Skip to content

Instantly share code, notes, and snippets.

View flarb's full-sized avatar

Ralph Barbagallo flarb

View GitHub Profile
@flarb
flarb / NaturalOrientation.cs
Created August 4, 2012 00:03
How to detect the "natural" orientation of an Android device in Unity3D. Also can use to detect tablet and phone.
using UnityEngine;
using System.Collections;
public class NaturalOrientation : MonoBehaviour {
public static int ORIENTATION_UNDEFINED = 0x00000000;
public static int ORIENTATION_PORTRAIT = 0x00000001;
public static int ORIENTATION_LANDSCAPE = 0x00000002;
public static int ROTATION_0 = 0x00000000;
@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;
@flarb
flarb / DiffuseDetailAmbient.shader
Created February 16, 2012 09:42
Mobile Ambient Diffuse Detail shader for Unity3D - just a simple one line change.
Shader "Mobile/Ambient Diffuse Detail" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
_Detail ("Detail (RGB)", 2D) = "gray" {}
}
SubShader {
Pass{