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 / CharController.cs
Last active July 12, 2023 03:50
Camera-relative character movement controller. Does not handle animation, but has some comments where you'd want to add the hooks
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace PixelWizards.GameSystem.Controllers
{
// the data model for the character controller. I like to keep vars like this in a separate class to organize them
// and keep the main controller script as clean as possible.
// because it is set to be serializable, these vars are exposed in the editor (except where noted) when you attach
// the CharController component to your character
@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 / ResourceChecker.cs
Last active January 30, 2020 14:55
Gives you a list of resources (objects, materials, textures) used in a scene, super helpful for optimizing scenes (mobile etc) - updated for 2019.x
// Resource Checker
// (c) 2012 Simon Oliver / HandCircus / hello@handcircus.com
// (c) 2015 Brice Clocher / Mangatome / hello@mangatome.net
// Public domain, do with whatever you like, commercial or not
// This comes with no warranty, use at your own risk!
// https://github.com/handcircus/Unity-Resource-Checker
using System;
using System.Linq;
using UnityEngine;
@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
@gekidoslair
gekidoslair / CustomEditorBase.cs
Created September 26, 2017 23:29
want proper re-orderable lists by default for all inspectors in #unity3d? drop this into an editor folder and it magically works ;P
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using System.Collections.Generic;
using UnityEditor.AnimatedValues;
[CustomEditor(typeof(UnityEngine.Object), true, isFallback = true)]
[CanEditMultipleObjects]
public class CustomEditorBase : Editor
{