Skip to content

Instantly share code, notes, and snippets.

View DevEarley's full-sized avatar
🎯
Focusing

Alex Earley DevEarley

🎯
Focusing
View GitHub Profile
@DevEarley
DevEarley / modding_mecha_mgmt.md
Created August 13, 2025 14:37
How to mod Mecha MGMT🤖🔨
@DevEarley
DevEarley / MechaMGMT_ENUMS.gd
Last active August 19, 2025 22:57
ENUMS for Mecha MGMT modding
1.1.6
enum LOCATION_ID{
UNDECIDED = -1,
SUNFIRE=0,
MUCKTHORN=1,
STEELHAVEN=2,
EMERALD_TOWERS=3,
DEEP_SPACE=4,
THE_VEIL=5,
@DevEarley
DevEarley / GODOT - Decal shadow for compatibility mode.md
Last active February 25, 2025 18:06
Shadow "Decal" script for compatibility mode.

If you are planning on using GODOT in compatability mode, you will not be able to use certain features. Like Decals.

This script will give you a similar effect to decals using a 3D Sprite. There are probably other ways to do this, but this works well for me.

SHADOW file: https://i.imgur.com/BsDkdEY.png

Example setup: https://i.imgur.com/sUOgWMH.png

    _,.---._                     ,----.    ,-,--.  ,--.--------.  
  ,-.' - ,  `.   .--.-. .-.-. ,-.--` , \ ,-.'-  _\/==/,  -   , -\ 
 /==/ ,    -  \ /==/ -|/=/  ||==|-  _.-`/==/_ ,_.'\==\.-.  - ,-./ 
|==| - .=.  ,  ||==| ,||=| -||==|   `.-.\==\  \    `--`\==\- \    
|==|  : ;=:  - ||==|- | =/  /==/_ ,    / \==\ -\        \==\_ \   
|==|,  '='  ,  ||==|,  \/ - |==|    .-'  _\==\ ,\       |==|- |   
 \==\ _   -    ;|==|-   ,   /==|_  ,`-._/==/\/ _ |      |==|, |   
  '.='.  ,  ; -\/==/ , _  .'/==/ ,     /\==\ - , /      /==/ -/   
 `--`--'' `--`--`..---' `--`-----`` `--`---' `--`--` 
@DevEarley
DevEarley / google-sheet-number-formats.md
Created November 8, 2024 22:26
Google Sheet Number Formats for Profiling

Google Sheet Number Formats for Profiling

Nanoseconds & Milliseconds

[<1000000]##0.00" NS";##0.00,," MS"

Thousands & Millions

[&lt;1000]##0.00" ";[&lt;1000000]##0.00," K";##0.00,," M"
@DevEarley
DevEarley / RNGController.cs
Created December 2, 2023 17:47
C# RNG implementation for Unity3D
public class RNGController : MonoBehaviour
{
private int index = 0;
private int lastLargestIndex = 0;
private int max_index = 1000;
private List <int> values = new List<int>();
public int Next(int RNG_ID)
{
var offsetIndex = RNG_ID + index;
@DevEarley
DevEarley / ScreenResolutionUtility.cs
Last active March 25, 2024 10:52
Static Screen Resolution Utility for Unity 3D with Common Resolutions
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum CommonScreenResolutions
{
gameConsole_16bit_pocket_10x9, //160 × 144 160∶144 10:9 1∶1
gameConsole_16bit_low_4x3, //256 × 224 256∶224 4∶3 7∶6
gameConsole_16bit_super_4x3, //400 × 300 4∶3 4∶3 1∶1
gameConsole_32bit_low_4x3, //256 × 224 256∶224 4∶3 7∶6
@DevEarley
DevEarley / InputController.cs
Created April 28, 2023 19:01
Unity Input Controller & Service
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public enum InputControllerState
{
NO_INPUT_DEVICE_CONNECTED,
NO_CONTROLLER_CONNECTED,
NO_KEYBOARD_CONNECTED,
BOTH_KEYBOARD_AND_CONTROLLER_CONNECTED
@DevEarley
DevEarley / unity3d-basic-classes.md
Last active July 3, 2023 15:45
Unity3D basic classes

Behaviours

  • Attached to a GO. Many GOs may have this script.
  • A MonoBehaviour.
  • Can be used multiple times in a scene.
  • Can implement interfaces.
  • Great for enemy behaviour, trigger & door logic, reacting to OnTrigger events.

Controllers

  • Attached to a GO like a Behaviour
  • Single instance of this may exist in a scene at once.
@DevEarley
DevEarley / A-service-locator-in-unity.md
Last active October 10, 2022 20:13
Service Locator pattern in Unity3D

Service Locator pattern in Unity3D

Using the Service Locator pattern in Unity allows you connect various services together to a single source. When a script needs access to something on the Service Locator, it just needs to access the Service Locators's Instance. This instance will have any service the invoker may need.

To setup, the service must be referenced in the script and the script must find these services on Awake. You can look them up by the GameObject they are attached to or attach them to the Service Locator's GO. In this example, I use GetComponentInChildren<T>(). Alternatively you can search for the GameObject by name and then get the component, PlayerController = GameObject.Find("PlayerController").GetComponent<PlayerController>();

  • Contains references to all Controllers and all Services.
  • Attached to a GO.
  • Must reference all controllers and services automatically.