Skip to content

Instantly share code, notes, and snippets.

View robinnorth's full-sized avatar
:octocat:

Robin North robinnorth

:octocat:
View GitHub Profile
@SeanMcTex
SeanMcTex / PinToSafeArea.cs
Last active March 2, 2024 07:27
Restrict Unity UI to an iPhone X or other Mobile Device's Safe Area
using UnityEngine;
/// <summary>
/// Resizes a UI element with a RectTransform to respect the safe areas of the current device.
/// This is particularly useful on an iPhone X, where we have to avoid the notch and the screen
/// corners.
///
/// The easiest way to use it is to create a root Canvas object, attach this script to a game object called "SafeAreaContainer"
/// that is the child of the root canvas, and then layout the UI elements within the SafeAreaContainer, which
/// will adjust size appropriately for the current device./// </summary>
@n0mimono
n0mimono / YouTubeLiveController.cs
Created February 12, 2018 06:10
Unity script example for YouTube Live Streaming API
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System;
using System.Net;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.Networking;
using SimpleJSON;
@dpid
dpid / how-to-notarize-unity-for-macos.md
Last active December 6, 2023 20:42
How to notarize a Unity build for MacOs 10.15 Catalina

How to notarize a Unity build for macOs 10.15 Catalina

As of January 2020, all apps running on macOs 10.15 Catalina are required to be notarized. For Unity games distributed outside the Mac App Store, such as with Steam, the notarization process is done post build using a series of Xcode command line tools.

Prerequisites

  • a Mac that is compatible with macOs 10.15 Catalina :
    • MacBook (2015 or newer)
    • MacBook Air (2012 or newer)
  • MacBook Pro (2012 or newer)
@Naphier
Naphier / UGuiTextToTextMeshPro.cs
Created January 4, 2017 15:23
Unity3D Editor Tool to convert Unity GUI Text objects to Text Mesh Pro Text Objects
using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
using TMPro;
using TMPro.EditorUtilities;
public class UGuiTextToTextMeshPro : Editor
{
[MenuItem("GameObject/UI/Convert To Text Mesh Pro", false, 4000)]
static void DoIt()
@benjibee
benjibee / scrape.js
Created February 10, 2018 13:19
A little script to import starred places saved as geoJSON data from Google Maps. Could be better. Works.
// This script is meant to import Google Maps starred places into
// another Google account.
// Given a geoJSON file of Google Maps starred places (places.json)
// exported by Google takeout (account backup) this script should
// open each place URL and manually click save.
// Upon first run, it's best to stop it and manually login to your
// Google account otherwise you'll run into a non-verified device
// issue. Run again and it should continue through with problems.
@passsy
passsy / material text sizes.md
Last active May 25, 2023 04:24
Material font sizes
@pyjamads
pyjamads / AutoExpandGridLayoutGroup.cs
Last active December 29, 2022 10:07
A Unity UI Auto expanding grid layout group, that automatically changes column and row count - adapted from collin_patrick's AutoExpandGridLayoutGroup https://forum.unity.com/threads/solved-how-to-make-grid-layout-group-cell-size-x-auto-expand.448534/
namespace UnityEngine.UI
{
[AddComponentMenu("Layout/Auto Expand Grid Layout Group", 152)]
public class AutoExpandGridLayoutGroup : LayoutGroup
{
public enum Corner { UpperLeft = 0, UpperRight = 1, LowerLeft = 2, LowerRight = 3 }
public enum Axis { Horizontal = 0, Vertical = 1 }
public enum Constraint { Flexible = 0, FixedColumnCount = 1, FixedRowCount = 2 }
[SerializeField]
@corymartin
corymartin / flags.js
Created April 15, 2012 14:55
Flag Enumerations in JavaScript
// Flag Enumerations in JavaScript
// ===============================
// Flag enums
// ----------
// Values must increment by powers of 2
var SEASONS = {
Spring : 1,
Summer : 2,
@roboshoes
roboshoes / touchmouse.js
Created April 13, 2012 10:43
This snippet maps mouse events and touch events onto one single event. This makes it easier in the code since you have to listen to only one event regardles whether it's desktop or mobile.
(function() {
/* == GLOBAL DECLERATIONS == */
TouchMouseEvent = {
DOWN: "touchmousedown",
UP: "touchmouseup",
MOVE: "touchmousemove"
}
/* == EVENT LISTENERS == */
#!/bin/bash -x
CALLERS_UID="$1"
REFCOUNT_PATH="$2"
DCALL_PATH="$3"
if [ $UID -ne 0 ]; then
# Test that the script is run as root.
echo "Script must run as root"
exit 1