Skip to content

Instantly share code, notes, and snippets.

View stramit's full-sized avatar

Tim Cooper stramit

View GitHub Profile
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");
@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
{
@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 / 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 / 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
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 / InputField.cs
Last active January 14, 2020 14:17
uGUI InputField (rc1)
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.Serialization;
namespace UnityEngine.UI
{
@stramit
stramit / PointerInputModule.cs
Last active October 18, 2018 05:25
Beta 19
using System.Collections.Generic;
using System.Text;
namespace UnityEngine.EventSystems
{
public abstract class PointerInputModule : BaseInputModule
{
public const int kMouseId = -1;
public const int kFakeTouchesId = -2;
using System.Collections.Generic;
using System.Reflection;
namespace UnityEngine.EventSystems
{
[AddComponentMenu("Event/Standalone Input Module")]
public class StandaloneInputModule : PointerInputModule
{
private float m_NextAction;
using System;
using System.Collections.Generic;
using UnityEngine.EventSystems;
using UnityEngine.UI.CoroutineTween;
namespace UnityEngine.UI
{
/// <summary>
/// Base class for all UI components that should be derived from when creating new Graphic types.
/// </summary>