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 / UnparentGameObject.cs
Last active April 25, 2023 16:54
Simple Editor tool (place in an /Editor folder) to unparent gameobjects in the hierarchy
using UnityEditor;
namespace PixelWizards.Utilities
{
public class UnparentGameObject
{
[MenuItem("Edit/Unparent GameObject", false, 0)]
static void UnparentGO()
{
var selection = Selection.activeTransform;
@gekidoslair
gekidoslair / DestroyOnPlay.cs
Created December 18, 2022 02:18
Destroys this object if we're in play mode. Useful for debug stuff that you don't want in the actual game
using UnityEngine;
namespace PixelWizards.Utilities
{
/// <summary>
/// Destroys this object if we're in play mode.
/// Useful for debug stuff that you don't want in the actual game
/// </summary>
public class DestroyOnPlay : MonoBehaviour
{
@gekidoslair
gekidoslair / DontDestroyOnLoad.cs
Created December 18, 2022 02:10
Simple component that sets the don't destroy on load property for the game object it is attached to
using UnityEngine;
public class DontDestroyOnLoad : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
DontDestroyOnLoad(this);
}
}
@gekidoslair
gekidoslair / SpawnOnAwake.cs
Created December 16, 2022 21:54
Simple class that allows you to spawn / instantiate any number of prefab game objects when a Unity scene loads. Useful for Bootstrap scenes & more
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace PixelWizards.GameSystem.Controllers
{
/// <summary>
/// Spawns any number of prefabs on Awake() when the scene loads
/// </summary>
public class SpawnOnAwake : MonoBehaviour
@gekidoslair
gekidoslair / RootMotionNavMesh.cs
Last active May 10, 2022 10:07
Root Motion based Navmesh characters in Unity
using UnityEngine;
using UnityEngine.AI;
namespace PixelWizards.GameSystem.Controllers
{
/// <summary>
/// All this does is implement the OnAnimatorMove() for our Units
/// </summary>
public class RootMotionNavMesh : MonoBehaviour
{
@gekidoslair
gekidoslair / OnlyOneCanSurvive.cs
Created October 12, 2021 02:19
Unity - Only One Can Survive
using UnityEngine;
namespace PixelWizards.GameSystem.Controllers
{
/// <summary>
/// Lets us include specific prefabs in multiple scenes and make sure we don't end up with duplicates in the end
/// sort of an inverse singleton pattern. Basically add this to a prefab, then add that prefab into any scene and
/// no matter what only one is ever active
/// </summary>
public class OnlyOneCanSurvive : MonoBehaviour
PHP script that uses Unity Publisher API for PHP (https://github.com/LostPolygon/Unity-Publisher-API-PHP) to retrieve new asset sales, put them into a MySQL database, and notify about the sales via e-mail.
Data is inserted into `sales` table, which can be created from sales_table.sql file. Just set up the credentials and put this script on cron with whatever interval you want. Delete the email notification part if you don't need it.
Requires PHP 5.4, php_json extension, and remote socket access.
Also, I know it's ugly, but it does the job and served me well for over a year.
@gekidoslair
gekidoslair / SetShadowQuality.cs
Last active March 10, 2021 06:05 — forked from Nobuyuki-Kobayashi/SetShadowQuality.cs
Configure Unity's built in Shadow Settings from script at runtime QualitySettings.shadowCascade4Split
//
// QualitySettings/Shadows内のShadow Distance/Shadow Cascades/Cascade splitsをシーンから設定する.
//
//
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace UnityChan
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
/// <summary>
/// A simple free camera to be added to a Unity game object.
///
/// Keys:
@gekidoslair
gekidoslair / EditorNote.cs
Last active May 30, 2020 16:51
Add to any gameobject to provide scene-view annotations
using UnityEditor;
using UnityEngine;
namespace PixelWizards.Utilities
{
public class EditorNote : MonoBehaviour
{
[TextArea]
public string m_Text;
public Vector3 m_Offset;