Skip to content

Instantly share code, notes, and snippets.

View gekidoslair's full-sized avatar
💭
Surfin the Chaos

Mike Wuetherick gekidoslair

💭
Surfin the Chaos
View GitHub Profile
@gekidoslair
gekidoslair / gist:dbbe29f37c46ca37d3a1
Created October 19, 2014 06:12
Parsing JSON into C# objects in Unity
public class CommunicationLayer : Monobehavior
{
public string response_message;
string baseAPIEndpoint = ClientConstants.GAMESERVER_URL; // base url for your API endpoints
/// <summary>
/// Sends a Generic API call. should be done via coroutine
/// </summary>
/// <returns>The API call.</returns>
/// <param name="endpoint">Endpoint we are wanting to hit</param>
{
"air_force_blue_raf": {
"name": "Air Force Blue (Raf)",
"hex": "#5d8aa8",
"rgb": [93, 138, 168]
},
"air_force_blue_usaf": {
"name": "Air Force Blue (Usaf)",
"hex": "#00308f",
"rgb": [0, 48, 143]
@gekidoslair
gekidoslair / UnityGuidRegenerator.cs
Created January 11, 2017 04:50 — forked from ZimM-LostPolygon/UnityGuidRegenerator.cs
Unity asset GUIDs regenerator
// Drop into Assets/Editor, use "Tools/Regenerate asset GUIDs"
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using UnityEditor;
namespace UnityGuidRegenerator {
public class UnityGuidRegeneratorMenu {
using UnityEngine;
using System.Collections;
public class RoamBetweenPoints : MonoBehaviour {
public Transform[] targets;
public LayerMask groundLayer;
private Transform target;
private NavMeshAgent agent;
@gekidoslair
gekidoslair / Customizer.cs
Last active September 8, 2017 05:57
Simple Customization Script, has a data model that could be used to save / store the customizations (for a save game or persistent state) as well as a simple randomization system for picking random elements at startup. The 'mandatory' flag is there because it does a pre-check to see if an element from this particular category should even be used…
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace PixelWizards.GameSystem.Controllers
{
public class CharacterCustomization
{
public int curBackpack = 0;
public int curBag = 0;
@gekidoslair
gekidoslair / FindMissingScriptsRecursivelyAndRemove.cs
Last active September 21, 2017 02:55
Cleans up missing references to components in a Unity scene. Uses some c# 4 magic, switch to experimental c# 4.6 runtime to use
using UnityEditor;
using UnityEngine;
namespace PixelWizards.Shared.Utilities
{
/// from this pastebin: https://pastebin.com/DLuE2Ze9
public class FindMissingScriptsRecursivelyAndRemove : EditorWindow
{
private static int _goCount;
private static int _componentsCount;
@gekidoslair
gekidoslair / QuickToggle.cs
Created September 21, 2017 02:08
Adds 'visibliity' and 'lock' icons to the Unity scene view, see https://chemikhazi.itch.io/unity-quick-toggle
/*
Copyright 2017, Jeiel Aranal
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
///
/// Simple pooling for Unity.
/// Author: Martin "quill18" Glaude (quill18@quill18.com)
/// Latest Version: https://gist.github.com/quill18/5a7cfffae68892621267
/// License: CC0 (http://creativecommons.org/publicdomain/zero/1.0/)
/// UPDATES:
/// 2015-04-16: Changed Pool to use a Stack generic.
///
/// Usage:
///
@gekidoslair
gekidoslair / TriggerEditor.cs
Created November 25, 2017 21:03 — forked from bzgeb/TriggerEditor.cs
Template for Custom Inspector Script in Unity3d
using UnityEngine;
using UnityEditor;
[CustomEditor (typeof(Trigger))]
[CanEditMultipleObjects()]
public class TriggerEditor : Editor
{
private SerializedObject obj;
private SerializedProperty radius;
@gekidoslair
gekidoslair / DrawBones.cs
Created February 7, 2018 00:40
Debug draw bones in the editor
using UnityEngine;
namespace PixelWizards.Shared.Utilities
{
/// <summary>
/// Debug draw bones in the editor
/// </summary>
public class ShowBones : MonoBehaviour
{
private Transform rootNode;