Skip to content

Instantly share code, notes, and snippets.

@nrichards
nrichards / SelectionUtilities_Extra.cs
Last active June 12, 2023 19:58
Unity: MonKey Commander: Custom command code-chunk to find Component by name in your Project
/// This is the magic, added to SelectionUtilities.cs function SelectOfType,
/// replacing the similar code, at the end of the function.
EditorUtility.ClearProgressBar();
if (Selection.objects.Length > 0) {
SetSelectionActiveVersionIndependent(Selection.objects[0]);
var components = ((GameObject)Selection.objects[0]).GetComponents(type);
foreach (var c in components) {
var niceName = ObjectNames.NicifyVariableName(c.GetType().Name);
EditorApplication.delayCall += () => {
@nrichards
nrichards / ReplaceWithPrefab.cs
Last active September 30, 2022 03:04 — forked from SiarheiPilat/ReplaceWithPrefab.cs
Unity 2022 script, ReplaceWithPrefab: To edit a scene's Prefab model and data, avoiding editing the original Prefab
using UnityEngine;
using UnityEditor;
/// Video: https://youtu.be/1FhVMFMG97Q
/// Taken from: https://gist.github.com/SiarheiPilat/05463e64d4662860c6a799bb23d9aec8
/// Forked from: https://gist.github.com/unity3dcollege/c1efea3f87d3775bee3e010e9c6d7648
/// Author: Siarhei Pilat (Suasor AB)
/// License: MIT
public class ReplaceWithPrefab : EditorWindow
@nrichards
nrichards / AdvertisementShowWait.cs
Created January 23, 2018 17:50
Unity AdvertisementShowWait
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.Advertisements;
/// <summary>
/// I show an advertisement, waiting until it is ready. Waiting can be stopped.
/// </summary>
@nrichards
nrichards / README.md
Last active August 29, 2015 14:27
SCM status Bash prompt supporting both hg and git
  1. Clone Git Prompt support https://github.com/jimeh/git-aware-prompt to ~/.bash/ (~/.bash/git-aware-prompt/)
  2. Add enclosed Mercurial Prompt support to ~/.bash/ (~/.bash/hg_prompt.sh)
  3. Integrate both into your ~/.bash_profile with:
# git prompt

export GITAWAREPROMPT=~/.bash/git-aware-prompt
source "${GITAWAREPROMPT}/main.sh"
@nrichards
nrichards / watch_and_dt.sh
Last active August 29, 2015 14:20
Auto-build OSX shell script watches directories, builds unless already building, using fswatch, stream_prettifier, and bash for Apportable 'dt' command line build
#!/bin/bash
# DESCRIPTION: watch_and_dt.sh - watches a set of hardcoded directories and builds
# with Apportable dt unless already building.
# REAQUIREMENTS: Apportable dt, optionally stream_prettifier, fswatch, osx
# OPTIONAL: Run piping to stream_prettifier with ~/.stream_prettifier file
# if_seen /Error|error/ do |line|
# line.white.on_red
# end
# if_seen /Building.*apk/ do |line|
# line.white.on_green
@nrichards
nrichards / trace.html
Created February 7, 2015 00:42
broken systrace
<!DOCTYPE HTML>
<html>
<head i18n-values="dir:textdirection;">
<meta charset="utf-8"/>
<title>Android System Trace</title>
<style type="text/css">* WARNING:This file is generated by generate_standalone_timeline_view.py * * Do not edit directly. */.analysis-link{color:-webkit-link;cursor:pointer;text-decoration:underline}.analysis-link:hover{cursor:pointer}x-generic-object-view{display:block;font-family:monospace}.analysis-results{font-family:monospace;white-space:pre}.analysis-results *{-webkit-user-select:text!important;cursor:text}.analysis-table{border-collapse:collapse;border-width:0;margin-bottom:25px}.analysis-table>tr>td:first-child{padding-left:2px}.analysis-table>tr>td{padding:2px 4px 2px 4px}.analysis-table-header{text-align:left}.analysis-table-row{vertical-align:top}.analysis-table-row:nth-child(2n+0){background-color:#e2e2e2}.selection-changing-link{color:-webkit-link;cursor:pointer;text-decoration:underline}.analysis-slices-table-col-1,.analysis-slices-table-col-2{text-align:right}.default-objec
@nrichards
nrichards / UIResponder+BackButton.h
Last active August 29, 2015 14:01
Simple back button handling for Apportable using UIResponder
//
// UIResponder+BackButton.h
//
// Created by Nick Richards
//
#import <UIKit/UIKit.h>
typedef void(^UIResponderBackButtonHandler)(void);
@nrichards
nrichards / Radial_Move_Converted.py
Created February 23, 2012 17:28
LightWave Python - Radial Move - Auto-converted
# Radial_Move_Converted.py
# Modeler plugin
# Based entirely upon Radial_Move.ls by:
# FaLogFx http://forums.newtek.com/showthread.php?t=123806
# aka Michael Andersson micke@bmck.se
#
# Converter http://www.lucidgears.com:21134/
# Forum http://forums.newtek.com/showthread.php?t=126039
#
@nrichards
nrichards / radial_move.py
Created February 23, 2012 07:35
LightWave 11 - Python Plugin - Radial Move
# WARNING: Some or all of this may be wrong! This is a learning exercise created by a newbie!
#
# radial_move.py
# Modeler plugin
# Based entirely upon Radial_Move.ls by:
# FaLogFx http://forums.newtek.com/showthread.php?t=123806
# aka Michael Andersson micke@bmck.se
#
# LightWave plugins:
# http://forums.newtek.com/showthread.php?t=123672