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 / PhysicsSettler.cs
Created December 30, 2019 23:58
Activate physics in Edit mode to dynamically drop or settle objects in a scene
using UnityEngine;
using UnityEditor;
using UnityEditor.ShortcutManagement;
namespace PixelWizards.Utilities
{
// This causes the class' static constructor to be called on load and on starting playmode
[InitializeOnLoad]
class PhysicsSettler
@gekidoslair
gekidoslair / DistributeEvenly.cs
Last active January 26, 2020 12:18
Distribute GameObjects in a scene evenly (along x, y or z axis)
using UnityEngine;
using UnityEditor;
using UnityEditor.ShortcutManagement;
namespace PixelWizards.Utilities
{
// This causes the class' static constructor to be called on load and on starting playmode
[InitializeOnLoad]
class PhysicsSettler
@gekidoslair
gekidoslair / CreateEmptyAtRoot.cs
Created November 10, 2019 17:13
Adds 'Create Empty at Root' shortcut for the GameObject / right-click context menu to create an empty gameobject at 0,0,0
using UnityEditor;
using UnityEngine;
namespace MWU.Shared.Utilities
{
public class CreateEmptyAtRoot : MonoBehaviour
{
[MenuItem("GameObject/Create Empty at Root", false, 0)]
public static void Create()
@gekidoslair
gekidoslair / ResetParentTransform.cs
Created November 10, 2019 01:07
Quick utility to reset a parent GameObject position to 0,0,0 without screwing up the child positions
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace MWU.Shared.Utilities
{
public static class ResetParentTransform
{
[MenuItem("Tools/Edit/Reset Parent Transform %_r")]
public static void DistributeObjectsEvenly()
@gekidoslair
gekidoslair / CharacterMeshBind.cs
Last active April 14, 2020 11:30
Bind clothing mesh to a parent character skin / rig
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace PixelWizards.CharacterCustomizer
{
/// <summary>
/// attach this to the clothing GO you want to attach (the GO with the SkinnedMeshRenderer)
/// drag the main character body you want to attach it to (the GO with the SkinnedMeshRenderer)
/// the clothing rig must have been the same rig the character's body used. the body parts (transforms) must be named the same thing
@gekidoslair
gekidoslair / UsingJsonDotNetInUnity.cs
Created April 15, 2019 02:15 — forked from onionmk2/UsingJsonDotNetInUnity.cs
Json.Net ( Newtonsoft.Json ) in Unity
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
using UnityEngine;
public class UsingJsonDotNetInUnity : MonoBehaviour
{
private void Awake()
{
@gekidoslair
gekidoslair / GameDashboard.cs
Created September 22, 2018 19:04
Simple editor window as a 'dashboard' for your Unity game
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
namespace PixelWizards.GameSystem.Utility.Editor
{
public class GameDashboard : EditorWindow
{
static int MinWidth = 150;
@gekidoslair
gekidoslair / ApplySelectedPrefabs.cs
Created July 13, 2018 17:56
Bulk apply / revert selected prefabs editor script
namespace PixelWizards.EditorTools
{
using UnityEditor;
using UnityEngine;
/// <summary>
/// Apply or revert multiple prefabs at the same time
/// Source: https://forum.unity3d.com/threads/little-script-apply-and-revert-several-prefab-at-once.295311/
/// </summary>
public class ApplySelectedPrefabs
@gekidoslair
gekidoslair / ConsoleCallStackHelper.cs
Created May 28, 2018 19:09 — forked from sabresaurus/ConsoleCallStackHelper.cs
Jump to file/line in the Unity console window callstack via this helper window
// MIT License
//
// Copyright (c) 2018 Sabresaurus
//
// 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:
@gekidoslair
gekidoslair / GenericTrigger.cs
Created April 30, 2018 16:59
Activate a Unity Timeline from a trigger
using UnityEngine;
using UnityEngine.Playables;
public class GenericTrigger : MonoBehaviour
{
public PlayableDirector timeline;
// Use this for initialization
void Start()
{