Skip to content

Instantly share code, notes, and snippets.

View fakegood's full-sized avatar

Low Jiahao fakegood

  • Kuala Lumpur, Malaysia
View GitHub Profile
@fakegood
fakegood / 1.txt
Created September 20, 2025 14:49 — forked from z-rui/1.txt
通用规范汉字表 (2013)
@fakegood
fakegood / ReferenceFinder.cs
Created February 19, 2025 05:48 — forked from ffyhlkain/ReferenceFinder.cs
A reference finder for assets in a #Unity3d project.
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using UnityEditor;
using UnityEngine;
using Debug = UnityEngine.Debug;
using Object = UnityEngine.Object;
namespace FoundationEditor.Editor.ReferenceFinder
{
@fakegood
fakegood / TerriblyHackyLog.cs
Created January 16, 2025 03:20 — forked from AngryAnt/TerriblyHackyLog.cs
Abusing reflection and the internal Unity player build error function to get stacktrace-less error logs. Not recommended for anything sane.
using UnityEngine;
using System.Reflection;
public class TerriblyHackyLog : MonoBehaviour
{
void Start ()
{
Log ("Aaaaarrrrgh!");
}
@fakegood
fakegood / ScreenEdge.cs
Created December 30, 2024 02:04 — forked from unitycoder/ScreenEdge.cs
Create Ortho Screen EdgeColliders2D - Collider Edge
// perspective camera, get far clip plane edges in world space (z is set to 0)
var bottomLeft = (Vector2)cam.ScreenToWorldPoint(new Vector3(0, 0, cam.farClipPlane));
var topLeft = (Vector2)cam.ScreenToWorldPoint(new Vector3(0, cam.pixelHeight, cam.farClipPlane));
var topRight = (Vector2)cam.ScreenToWorldPoint(new Vector3(cam.pixelWidth, cam.pixelHeight, cam.farClipPlane));
var bottomRight = (Vector2)cam.ScreenToWorldPoint(new Vector3(cam.pixelWidth, 0, cam.farClipPlane));
Debug.DrawLine(bottomLeft, topLeft, Color.red, 33);
Debug.DrawLine(topLeft, topRight, Color.green, 33);
Debug.DrawLine(topRight, bottomRight, Color.blue, 33);
Debug.DrawLine(bottomRight, bottomLeft, Color.magenta, 33);
@fakegood
fakegood / CanvasScalerOrientationDriver.cs
Created December 30, 2024 02:00 — forked from kurtdekker/CanvasScalerOrientationDriver.cs
CanvasScaler Orientation Driver - controls the CanvasScaler to simplify portrait / landscape adjustments
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
// @kurtdekker - to help fitting portrait / landscape UI stuff together
//
// Put this where the CanvasScaler is.
//
// You should set CanvasScaler to:
using UnityEngine;
using UnityEngine.UI;
// For a discussion of the code, see: https://www.hallgrimgames.com/blog/2018/11/25/custom-unity-ui-meshes
public class MyUiElement : MaskableGraphic
{
public float GridCellSize = 40f;
[SerializeField]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// by @kurtdekker - to make a Unity singleton that has some
// prefab-stored, data associated with it, eg a music manager
//
// To use: access with SingletonViaPrefab.Instance
//
// To set up:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// by @kurtdekker - to make a simple Unity singleton that has no
// predefined data associated with it, eg, a high score manager.
//
// To use: access with SingletonSimple.Instance
//
// To set up:
@fakegood
fakegood / CameraShake.cs
Created November 7, 2023 01:40 — forked from ftvs/CameraShake.cs
Simple camera shake effect for Unity3d, written in C#. Attach to your camera GameObject. To shake the camera, set shakeDuration to the number of seconds it should shake for. It will start shaking if it is enabled.
using UnityEngine;
using System.Collections;
public class CameraShake : MonoBehaviour
{
// Transform of the camera to shake. Grabs the gameObject's transform
// if null.
public Transform camTransform;
// How long the object should shake for.
///
/// Simple pooling for Unity.
/// Author: Martin "quill18" Glaude ([email protected])
/// 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:
///