Skip to content

Instantly share code, notes, and snippets.

View stramit's full-sized avatar

Tim Cooper stramit

View GitHub Profile
@stramit
stramit / package.json
Created June 1, 2018 09:33
Example Project Manifest
{
"dependencies": {
"com.unity.postprocessing": "file:../ScriptableRenderPipeline/com.unity.postprocessing",
"com.unity.render-pipelines.core": "file:../ScriptableRenderPipeline/com.unity.render-pipelines.core",
"com.unity.shadergraph": "file:../ScriptableRenderPipeline/com.unity.shadergraph",
"com.unity.render-pipelines.lightweight": "file:../ScriptableRenderPipeline/com.unity.render-pipelines.lightweight"
}
}
using UnityEngine.EventSystems;
namespace UnityEngine.UI
{
[AddComponentMenu("Layout/Content Size Fitter", 141)]
[ExecuteInEditMode]
[RequireComponent (typeof (RectTransform))]
public class ContentSizeFitter : UIBehaviour, ILayoutSelfController
{
using System;
using UnityEngine.Rendering;
namespace UnityEngine.Experimental.Rendering.LightweightPipeline
{
/// <summary>
/// A Custom tweaking of the LWRP using the passes system, in this example a 'WaterFXPass' is added
/// </summary>
public class MyLWRenderer : MonoBehaviour, IRendererSetup
{
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.LightweightPipeline;
[ImageEffectAllowedInSceneView]
public class WaterFXPass : MonoBehaviour, DefaultRendererSetup.IAfterSkyboxPass
{
private WaterFXPassImpl m_WaterFXPass;
@stramit
stramit / ScrollRect.cs
Created September 22, 2014 09:55
Scroll Rect
using System;
using UnityEngine.Events;
using UnityEngine.EventSystems;
namespace UnityEngine.UI
{
[AddComponentMenu ("UI/Scroll Rect", 33)]
[SelectionBase]
[ExecuteInEditMode]
@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;
@stramit
stramit / SpecialEventClass.cs
Last active November 21, 2018 06:36
SpecialEventClass
/*
* When developing the UI system we came across a bunch of things we were not happy
* with with regards to how certain events and calls could be sent in a loosely coupled
* way. We had this requirement because with a UI you tend to implement widgets that receive
* certain events, but you don't really want to have lots of glue code to manage them
* and keep track of them. The eventing interfaces we developed helped with this. One of
* the interesting things, is that they are not justfor the UI system! You can use this as
* a type-safe, fast, and simple alternative to SendMessage (never use SendMessage!).
* So how does it all work?
@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 June 10, 2019 16:16
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 / 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
{