Skip to content

Instantly share code, notes, and snippets.

View mrcarriere's full-sized avatar

Michael Carriere mrcarriere

  • Zapdot
  • Boston, MA
View GitHub Profile
@mrcarriere
mrcarriere / iPhone 14 Pro Max.device
Last active October 24, 2024 18:07
iPhone 14 Pro & Pro Max Device Definitions
{
"friendlyName": "Apple iPhone 14 Pro Max",
"version": 1,
"screens": [
{
"width": 1290,
"height": 2796,
"navigationBarHeight": 0,
"dpi": 460.0,
"orientations": [
@mrcarriere
mrcarriere / ButtonEvents.cs
Created August 7, 2022 22:09
Basic Component to make many Pointer Events available.
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
public class ButtonEvents : MonoBehaviour,
IPointerDownHandler,
IPointerUpHandler,
IPointerEnterHandler,
IPointerExitHandler,
IPointerClickHandler
@mrcarriere
mrcarriere / SceneSingleton.cs
Created March 19, 2017 00:08
Generic Singleton without persistence across scenes.
using UnityEngine;
public class SceneSingleton<T> : MonoBehaviour
where T : Component
{
private static bool _applicationIsQuitting = false;
private static T _instance = null;
public static T instance
{
@mrcarriere
mrcarriere / Singleton.cs
Created March 19, 2017 00:07
Generic Singleton for Unity
using UnityEngine;
public class Singleton<T> : MonoBehaviour
where T : Component
{
private static bool _applicationIsQuitting = false;
private static T _instance = null;
public static T instance
{
@mrcarriere
mrcarriere / keybase.md
Created March 3, 2017 22:31
Keybase Proof

Keybase proof

I hereby claim:

  • I am mrcarriere on github.
  • I am mcarriere (https://keybase.io/mcarriere) on keybase.
  • I have a public key ASBaVQcXV4Fj98vSIyYaLpyVN2cjosgK6H_77WTpDyQRDQo

To claim this, I am signing this object:

using System;
using System.Reflection;
using UnityEditor;
namespace Zapdot
{
public static class ConsoleTools
{
public static void ClearLog()
{
@mrcarriere
mrcarriere / SaveSceneOnPlay.cs
Last active November 17, 2016 14:20
Automatically save dirty scenes and assets as soon as you enter playmode.
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
[InitializeOnLoad]
public class SaveSceneOnPlay
{
static SaveSceneOnPlay()
{
EditorApplication.playmodeStateChanged += () =>
@mrcarriere
mrcarriere / BuildSceneProcessor.cs
Last active June 7, 2021 12:58
Automatically add a scene to your Build Settings when you create or save the scene. Scenes that are ignored will not re-prompt for the current session.
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
// docs: https://docs.unity3d.com/ScriptReference/AssetModificationProcessor.OnWillSaveAssets.html
public class BuildSceneProcessor : UnityEditor.AssetModificationProcessor
{
private const string DIALOG_TITLE = "Add to Build Settings?";
private const string DIALOG_MSG = "Add to build settings for inclusion in future builds?";
@mrcarriere
mrcarriere / StopPlayingOnRecompile.cs
Last active October 11, 2018 16:42
Force Unity to stop playing if you have edited a source file. Helps avoid some editor crashes and false positives / error spam. To use, drop this script in an "Editor" folder in your project.
using UnityEditor;
[InitializeOnLoad]
public class StopPlayingOnRecompile
{
static StopPlayingOnRecompile()
{
AssemblyReloadEvents.beforeAssemblyReload += () =>
{
if (EditorApplication.isPlaying)