Skip to content

Instantly share code, notes, and snippets.

@Arakade
Arakade / WIPController.cs.scaleAndSphere.patch
Created November 23, 2016 00:37
Patch to WIPController to account for scaling and allow SphereCast for grounded check
.../VR-Step/Scripts/WIPController.cs | 28 ++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/Assets/VR-Step/Scripts/WIPController.cs b/Assets/VR-Step/Scripts/WIPController.cs
index 2138c61..fa6e828 100644
--- a/Assets/VR-Step/Scripts/WIPController.cs
+++ b/Assets/VR-Step/Scripts/WIPController.cs
@@ -60,6 +60,12 @@ namespace VRStep
[Tooltip("Threshold on the accelerometer in the up direction of when to detect a jump")]
public float jumpDetectionThreshold = 1;
@Arakade
Arakade / AbstractGenericProtected.cs
Last active September 24, 2016 16:22
Class compiles in MonoDevelop Unity 3.5 full profile and VisualStudio but not Unity 5.4.0 - Unity bug 834988
using System;
namespace MiscCSharp {
public static class AbstractGenericProtected {
public static void Main(string[] args) {
var debugGraph = new DebugGraph { start = 5, end = 4, numRecords = 10 };
var floatSeries = new FloatSeries(debugGraph, "series1");
floatSeries.doStuff();
System.Console.WriteLine("All done");
@Arakade
Arakade / RippleCreator.cs.patch
Last active September 3, 2016 12:58
Patch for RealisticWater Unity Asset's RippleCreator to integrate with MasterAudio for splash sound. https://www.assetstore.unity3d.com/en/#!/content/33434
diff --git a/Assets/RealisticWater/Scripts/Water/RippleCreator.cs b/Assets/RealisticWater/Scripts/Water/RippleCreator.cs
index 9282d1b..cee8c48 100644
--- a/Assets/RealisticWater/Scripts/Water/RippleCreator.cs
+++ b/Assets/RealisticWater/Scripts/Water/RippleCreator.cs
@@ -1,3 +1,6 @@
+// define to include Master Audio integration for splash sound
+#define MASTERAUDIO
+
using UnityEngine;
using System.Collections.Generic;
@Arakade
Arakade / RandomGrabBag.cs
Created May 20, 2016 13:32
A way to repeatedly randomly choose from an initially provided set of possibilities.
// Copyright Rupert Key, 2016
// Published under BSD license (commercial-friendly use as you wish but recognize owner wrote it)
using System.Collections.Generic;
// uses UnityEngine for Random.Range()
namespace UGS.Random {
/// <summary>
/// A way to repeatedly randomly choose from an initially provided set of possibilities.
@Arakade
Arakade / unity-pkg-extract.sh
Created April 29, 2016 19:39
Extract unitypackage contents from extracted directory into more normal form.
#!/bin/bash
# Extract unitypackage contents from extracted directory into more normal form.
# Rupert Key, 2014/09/15-ish
# TODO: Make it extract from the .unitypackage (tar.gz) so don't need initial extract step.
# RK: On updating, don't forget to update the public version!
# Public: If you want, please ping me with any changes / requests.
if [ $# -ne 2 -o "$1" == "-h" ] ; then
@Arakade
Arakade / Base.cs.patch
Created February 16, 2016 10:57
A* Project better colours for tag visualization
diff --git "a/C:\\Users\\User\\AppData\\Local\\Temp\\TortoiseGit\\Bas7CB4.tmp\\Base-25a36d5-left.cs" "b/D:\\Users\\User\\Dev\\Unity3D\\AIExperiments\\Assets\\AstarPathfindingProject\\Generators\\Base.cs"
index c530058..a8802b7 100644
--- "a/C:\\Users\\User\\AppData\\Local\\Temp\\TortoiseGit\\Bas7CB4.tmp\\Base-25a36d5-left.cs"
+++ "b/D:\\Users\\User\\Dev\\Unity3D\\AIExperiments\\Assets\\AstarPathfindingProject\\Generators\\Base.cs"
@@ -304,7 +304,7 @@ namespace Pathfinding {
c = Color.Lerp (AstarColor.ConnectionLowLerp,AstarColor.ConnectionHighLerp, ((float)node.Penalty-AstarPath.active.debugFloor) / (AstarPath.active.debugRoof-AstarPath.active.debugFloor));
break;
case GraphDebugMode.Tags:
- c = AstarMath.IntToColor ((int)node.Tag,0.5F);
+ c = AstarColor.GetAreaColor(node.Tag);
@Arakade
Arakade / GridGeneratorEditor.cs.patch
Created February 15, 2016 23:21
A* Project patch to enable ASTARDEBUG shift-mouse-over displaying path information
diff --git "a/C:\\Users\\User\\AppData\\Local\\Temp\\TortoiseGit\\Gri8182.tmp\\GridGeneratorEditor-c900cb4-left.cs" "b/C:\\Users\\User\\AppData\\Local\\Temp\\TortoiseGit\\Gri8162.tmp\\GridGeneratorEditor-bd6560d-right.cs"
index b636bd5..1facb21 100644
--- "a/C:\\Users\\User\\AppData\\Local\\Temp\\TortoiseGit\\Gri8182.tmp\\GridGeneratorEditor-c900cb4-left.cs"
+++ "b/C:\\Users\\User\\AppData\\Local\\Temp\\TortoiseGit\\Gri8162.tmp\\GridGeneratorEditor-bd6560d-right.cs"
@@ -1,3 +1,5 @@
+#define ASTARDEBUG
+
using UnityEngine;
using UnityEditor;
using Pathfinding.Serialization.JsonFx;
@Arakade
Arakade / AstarPathEditor.cs.all-assemblies-part-2.patch
Created February 15, 2016 09:35
Part 2 of a patch for A* Project's AstarPathEditor that fixes sections guarded by #define ASTARDEBUG
diff --git "a/C:\\Users\\User\\AppData\\Local\\Temp\\TortoiseGit\\Ast5870.tmp\\AstarPathEditor-25a36d5-left.cs" "b/D:\\Users\\User\\Dev\\Unity3D\\AIExperiments\\Assets\\AstarPathfindingProject\\Editor\\AstarPathEditor.cs"
index 2d23473..2e27f4b 100644
--- "a/C:\\Users\\User\\AppData\\Local\\Temp\\TortoiseGit\\Ast5870.tmp\\AstarPathEditor-25a36d5-left.cs"
+++ "b/D:\\Users\\User\\Dev\\Unity3D\\AIExperiments\\Assets\\AstarPathfindingProject\\Editor\\AstarPathEditor.cs"
@@ -1,3 +1,5 @@
+#define ASTARDEBUG
+
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
@Arakade
Arakade / gist:9dd844c2f9c10e97e3d0
Created January 3, 2015 16:54
Call from OnDrawGizmos() to draw text at Unity3D glocal position in Editor
static void drawString(string text, Vector3 worldPos, Color? colour = null) {
UnityEditor.Handles.BeginGUI();
if (colour.HasValue) GUI.color = colour.Value;
var view = UnityEditor.SceneView.currentDrawingSceneView;
Vector3 screenPos = view.camera.WorldToScreenPoint(worldPos);
Vector2 size = GUI.skin.label.CalcSize(new GUIContent(text));
GUI.Label(new Rect(screenPos.x - (size.x / 2), -screenPos.y + view.position.height + 4, size.x, size.y), text);
UnityEditor.Handles.EndGUI();
}
@Arakade
Arakade / AssertionComponentEditor.cs.patch
Created July 13, 2014 14:17
AssertionComponentEditor should includeChildren so Comparer/ActionBase subclasses can include Arrays, etc.
.../UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ProjectName/Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs b/ProjectName/Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs
index 1860f7b..c5d19a0 100644
--- a/ProjectName/Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs
+++ b/ProjectName/Assets/UnityTestTools/Assertions/Editor/AssertionComponentEditor.cs
@@ -208,7 +208,7 @@ namespace UnityTest
var sp = so.FindProperty(prop.Name);
if (sp != null)