Skip to content

Instantly share code, notes, and snippets.

Emil Johansen AngryAnt

Block or report user

Report or block AngryAnt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@AngryAnt
AngryAnt / DualDisplay.cs
Last active Aug 27, 2019
Example use of the Unity 4.1 AirPlay API - gives a setup with the iOS device as controller of the remote display.
View DualDisplay.cs
using UnityEngine;
using System.Collections;
/*
Runtime use:
To be available, AirPlay needs to be switched on for the device either via a native AirPlay UI component or
via the global AirPlay mirroring setting. Your options are:
A: Modify your Xcode project to layer a native AirPlay Cocoa control somewhere over your Unity content.
View CoroutineData.cs
//#define DEBUG_THREADING
using UnityEngine;
using System.Collections;
using System.Threading;
using System.Reflection;
public delegate IEnumerator MonitorCoroutine<T> (CoroutineData<T> data);
@AngryAnt
AngryAnt / TerriblyHackyLog.cs
Created Aug 7, 2013
Abusing reflection and the internal Unity player build error function to get stacktrace-less error logs. Not recommended for anything sane.
View TerriblyHackyLog.cs
using UnityEngine;
using System.Reflection;
public class TerriblyHackyLog : MonoBehaviour
{
void Start ()
{
Log ("Aaaaarrrrgh!");
}
@AngryAnt
AngryAnt / TotalBounds.cs
Created Aug 18, 2011
Getting the total rendering bounds of a hierarchy of renderers.
View TotalBounds.cs
private Bounds bounds;
void Start ()
{
bounds = new Bounds (transform.position, Vector3.one);
Renderer[] renderers = GetComponentsInChildren<Renderer> ();
foreach (Renderer renderer in renderers)
{
bounds.Encapsulate (renderer.bounds);
View Jerboa.swift
//
// main.swift
// Jerboa
//
// Created by Emil Johansen on 19/01/2019.
// Copyright © 2019 AngryAnt. All rights reserved.
//
// https://en.wikipedia.org/wiki/Jerboa
//
@AngryAnt
AngryAnt / EditorWindowExample.cs
Created Jun 15, 2012
EditorWindowExample from the Unity Asia Bootcamp 12 talk "Streamlining your Unity editor". A simple node based editor.
View EditorWindowExample.cs
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class EditorWindowExample : EditorWindow
{
List<Node> nodes = new List<Node> ();
@AngryAnt
AngryAnt / Build.sh
Created Sep 30, 2012
Example code for "Downloading the hydra" blog post on AngryAnt.com
View Build.sh
mcs -target:library -out:MyAssembly.dll -r:/Applications/Unity/Unity.app/Contents/Frameworks/UnityEngine.dll MyAssembly.cs
@AngryAnt
AngryAnt / Styles.cs
Created Jun 29, 2012
Handy utility functions for creating solid colour textures for GUI use.
View Styles.cs
// Usage:
m_SideBarTexture = CreateTexture (CreateColor ("#30433C"));
// The goodness:
static Color CreateColor (string hexCode, float alpha = 1.0f)
{
if (hexCode.Length == 7 && hexCode[0] == '#')
{
@AngryAnt
AngryAnt / Abstraction.cs
Last active Nov 7, 2017
The Behave runtime.
View Abstraction.cs
public BehaveResult TickShuffleAction (Tree sender)
{
return m_ShuffleTree.Tick ();
}
public void ResetShuffleAction (Tree sender)
{
m_ShuffleTree.Reset ();
}
@AngryAnt
AngryAnt / ComponentLister.cs
Created Sep 29, 2012
Example code for "Where did that component go?" blog post on AngryAnt.com
View ComponentLister.cs
using UnityEngine;
using UnityEditor;
using System.Collections;
public class ComponentLister : EditorWindow
{
private Hashtable sets = new Hashtable();
private Vector2 scrollPosition;
You can’t perform that action at this time.