Skip to content

Instantly share code, notes, and snippets.

View stramit's full-sized avatar

Tim Cooper stramit

  • Copenhagen
View GitHub Profile
using System;
using UnityEngine.Events;
using UnityEngine.EventSystems;
namespace UnityEngine.UI
{
/// <summary>
/// Simple toggle -- something that has an 'on' and 'off' states: checkbox, toggle button, radio button, etc.
/// </summary>
[AddComponentMenu("UI/Toggle", 35)]
@stramit
stramit / GraphicRaycaster.cs
Created June 25, 2014 08:12
GraphicRaycaster
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine.EventSystems;
namespace UnityEngine.UI
{
[AddComponentMenu("Event/Graphic Raycaster")]
[RequireComponent(typeof(Canvas))]
public class GraphicRaycaster : BaseRaycaster, ISerializationCallbackReceiver
@stramit
stramit / ControllerInputModule.cs
Last active December 27, 2018 18:20
ControllerInputModule.cs
using UnityEngine;
using UnityEngine.EventSystems;
[AddComponentMenu("Event/Controller Input Module")]
public class ControllerInputModule : BaseInputModule
{
private float m_NextAction;
protected ControllerInputModule()
{}
@stramit
stramit / UnityMethodValidator.cs
Last active May 25, 2024 02:36
Unity Method Validator
//Enable this if you want it to work in NUNIT, see the test example at the bottom
//#define UNIT_TESTING
/**
*
* https://i.imgur.com/GoH9rkv.png
*
* One of the frustrating things about Unity is that there are a spate of magic methods that can be
* called from the runtime. They do not have an interface defined, which by itself is pretty frustrating,
* but it can allow some valid c# that is bad Unity mojo. Consider a private 'OnEnable' function unity
@stramit
stramit / CoroutineTween.cs
Last active August 16, 2016 23:34
CoroutineTween.cs
/*
* This code is provided as is without warranty, guarantee of function,
* or provided support
*/
using System.Collections;
using UnityEngine.Events;
namespace UnityEngine.UI.CoroutineTween
{
using UnityEngine;
using UnityEditor;
//Put this under a folder called Editor in your project
public class EmptyGOCreator
{
[MenuItem ("GameObject/Create Empty at level %g")]
static void CreateEmptyGOAtLevel ()
{
var go = new GameObject("GameObject");