Skip to content

Instantly share code, notes, and snippets.

View Naxum's full-sized avatar

Jake Sawyer Naxum

View GitHub Profile
@Naxum
Naxum / application.controller.js
Last active February 24, 2016 20:38
Arrays not updating when elements are modified
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@Naxum
Naxum / ResponsiveLayoutGroup.cs
Last active January 2, 2016 19:21
http://i.imgur.com/q9KqufZ.png Replacement for Horizontal or VerticalLayoutGroups in Unity when switching direction on orientation/screen size changes. It took a while to get the code to a stable point that also includes basic features like layout, padding, and spacing. Feel free to use however you like, but if you notice a bug or have an improv…
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
public class ResponsiveLayoutGroup : LayoutGroup {
[Tooltip("Use this to flip which axis should be used in each orientation")]
public bool reverseLayout;
public Vector2 spacing = Vector2.zero;
@Naxum
Naxum / NaxHelper.cs
Last active August 29, 2015 14:07
Quick Instantiate with returned component of prefab you used to spawn it
using UnityEngine;
/*
I really hate having to type this long line of a code to get the component of a prefab I want to spawn (Transform for simplicity)
Transform t = (GameObject.Instantiate(prefabTransform.gameObject) as GameObject).GetComponent<Transform>();
Now all I have to type is:
@Naxum
Naxum / ActorManager
Created May 22, 2014 23:38
How to spawn a gameobject with a component and keep track of it
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class ActorManager : MonoBehaviour
{
public Actor actorPrefab;
public List<Actor> actors = new List<Actor>();
void Start()
@Naxum
Naxum / SimpleExtension.cs
Last active August 29, 2015 14:01
Simple custom Unity references with caching
using UnityEngine;
using System.Collections;
public class NaxBehaviour : MonoBehaviour
{
private PathFinder _pathFinder;
public PathFinder pathFinder
{
get
@Naxum
Naxum / Unit.cs
Created May 7, 2014 16:15
Simple Coroutine! One simple coroutine, another utilizing an animation curve to smooth the lerp in a sexy way!
using UnityEngine;
using System.Collections;
public class Unit : MonoBehaviour
{
public Transform target;
void Start(){
StartCoroutine(MoveTo(target))
}