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; | |
using UnityEngine; | |
public class TangentSpaceBasisVisualizer : MonoBehaviour | |
{ | |
void GetTangentSpaceBasis(Mesh mesh, int triangleIndex, Vector3 barycentricCoordinates,out Vector3 tangent,out Vector3 binormal, out Vector3 normal) { | |
Vector3[] normals = mesh.normals; | |
Vector4[] tangents = mesh.tangents; |
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 UnityEngine.EventSystems; | |
using UnityEngine.UI; | |
using UnityEngine.Events; | |
public static class PointerCallbackExtensions { | |
static void AddPointerEventCallback(this GameObject obj,EventTriggerType triggerType,UnityAction<BaseEventData> ev) { |
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; | |
#if UNITY_EDITOR | |
using UnityEditor; | |
#endif | |
//See http://g.recordit.co/sYme8QQg2L.gif for an example of usage | |
public class ExclusiveChildren : MonoBehaviour { | |
#if UNITY_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
Shader "Custom/SeeThrough" { | |
Properties { | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
_NormalColor ("Normal Color", Color) = (1.0,0.0,0.0) | |
_SeeThroughColor ("See-trough Color", Color) = (0.0,1.0,0.0) | |
} | |
SubShader { | |
Tags { "Queue"="Overlay" } | |
LOD 200 | |
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 UnityEngine; | |
//Now Debug.Log ("End printing") will be shown when you cancel the inner coroutine | |
public class CancellabeEnumeratorTest : MonoBehaviour { | |
static int a = 0; | |
IEnumerator printRoutine = null; | |
void Start() { |
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; | |
//Shouldn't we see the Debug.Log ("End printing") ? | |
public class EnumTest : MonoBehaviour { | |
static int a = 0; | |
IEnumerator printRoutine = null; | |
void Start() { | |
StartCoroutine (main ()); |
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
//The magic method | |
-(id (^)(id,...)) getSelector:(SEL) aSelector forTarget:(id) target withFirstArguments:(id) firstArguments, ... { | |
NSMutableArray* firstArgumentsArray = [NSMutableArray array]; | |
va_list first_args; | |
va_start(first_args, firstArguments); | |
do | |
{ | |
[firstArgumentsArray addObject:firstArguments]; | |
} |
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
//Define the methods | |
-(int) sumA:(int) a withB:(int)b { | |
return a + b; | |
} | |
-(int (^)(int)) sumWithA:(int)a { | |
int (^blockName)(int) = ^int(int b) { | |
return [self sumA:a withB:b]; |
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
describe('tabs', function() { | |
var elm, scope; | |
// load the tabs code | |
beforeEach(module('tabs')); | |
// load the templates | |
// beforeEach(module('tpl/tabs.html', 'tpl/pane.html')); | |
beforeEach(inject(function($rootScope, $compile) { |
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
http://webreflection.blogspot.pt/ | |
http://perfectionkills.com/ | |
http://www.quirksmode.org/blog/ |
NewerOlder