Skip to content

Instantly share code, notes, and snippets.

View goshki's full-sized avatar
👨‍💻
Such development, much coding. 😵‍💫

Adrian K. goshki

👨‍💻
Such development, much coding. 😵‍💫
View GitHub Profile
@PopupAsylumUK
PopupAsylumUK / HexGridLayout.cs
Last active April 14, 2026 07:02
A Layout group for arranging children in a hexagon grid, and a Hexagon graphic
using UnityEngine;
using UnityEngine.UI;
public class HexGridLayout : LayoutGroup {
const float SQUARE_ROOT_OF_3 = 1.73205f;
public enum Axis { Horizontal = 0, Vertical = 1 }
public enum Constraint { Flexible = 0, FixedColumnCount = 1, FixedRowCount = 2 }
@yasirkula
yasirkula / GradientGraphic.cs
Last active February 20, 2026 07:34
Create 4-color gradient UI graphics in Unity
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Sprites;
using UnityEngine.UI;
#if UNITY_2017_4 || UNITY_2018_2_OR_NEWER
using UnityEngine.U2D;
#endif
using Sprites = UnityEngine.Sprites;
#if UNITY_EDITOR
@AquaGeneral
AquaGeneral / SystemInfoInspector.cs
Created May 16, 2018 11:45
See all of the values that Unity's SystemInfo class contains. Reflection is used to remove redundant work, and simultaneously makes this work in any version of Unity (I hope). A lot of work can be done to make it look nicer.
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEditor;
using UnityEngine;
public class SystemInfoInspector : EditorWindow {
private static PropertyInfo[] properties;
private static MethodInfo[] methods;
private Vector2 scrollPosition;
@PopupAsylumUK
PopupAsylumUK / ActionExtensions.cs
Created May 2, 2018 15:55
Adds null checking invocations to Actions
using System;
public static class ActionExtensions {
public static void SafeInvoke(this Action action) {
if (action != null) {
action();
}
}
@LotteMakesStuff
LotteMakesStuff / PackageManagerExtentionExample.cs
Last active March 19, 2026 13:56
As of v1.9.3, Unity has added a simple extention API to the PackageManager UI. This small example shows you how to implment it and add a new window to the package manager. Note: you will need to change to the Staging package repository as time of writing. This code needs to go in an Editor folder
using System.Linq;
using UnityEditor;
using UnityEditor.PackageManager.UI;
using UnityEngine;
using UnityEngine.Experimental.UIElements;
using UnityEngine.Experimental.UIElements.StyleEnums;
using PackageInfo = UnityEditor.PackageManager.PackageInfo;
[InitializeOnLoad]
public class PackageManagerExtentionExample : IPackageManagerExtension
@cortvi
cortvi / !Collision Matrix.md
Last active August 11, 2023 19:50
Custom editor for Unity to make it easier to edit collision layer interactions.

Just download the script and put it in a "Editor" folder.

// threshold for mask can be controlled using vertex color alpha (useful for spriteRenderers or particle systems)
// _MainTex: alpha of this texture is used as a mask
// _EmissionTex: usually rgb noise texture, adjust it's scaling if needed
// color remap and oscilation for each channel of emission can be modified in _EmStrobeBFALR, _EmStrobeBFALG, _EmStrobeBFALB
// Base: base amplitude of brightness oscilation
// Freq: frequency of oscilation
// Ampl: amplitude of oscilation
// L: how much _EmissionTex affects this color
Shader "StandardWMask" {
@WikkidEdd
WikkidEdd / CreateSymlinkProject.cs
Last active November 19, 2023 11:45
Creates a symlinked version of a Unity project so you can easily do network development. Add script to Editor folder. Run from "Utils/Create Symlink Project" then choose directory to put symlink'd project in.
using UnityEngine;
using UnityEditor;
using System.Diagnostics;
public class CreateSymlinkProject {
[MenuItem("Utils/Create Symlink Project")]
static void DoIt()
{
string folderName = EditorUtility.SaveFolderPanel("Symlink Project Location", "", "");
@LotteMakesStuff
LotteMakesStuff / 1.md
Last active June 30, 2025 09:30
UPM: How to make a custom package

UPM: How to make a custom package So, Unity has this shiny new package manager, and you have code you want to share between projects - wouldn't it be great if we could bundle up our shared code and plug it into all the projects that need it? Let's figure out how to make our own Package!


Todo

  • Modify the project manifest
  • Make a package manifest
  • Package the manifest up with some test code
  • Try it out in Unity!

@mandarinx
mandarinx / GameEvent.cs
Created February 21, 2018 13:44
Game Events as ScriptableObjects
using System;
using System.Collections.Generic;
using UnityEngine;
namespace GameEvents {
[CreateAssetMenu(menuName = "Game Events/GameEvent")]
public class GameEvent : ScriptableObject {
private readonly List<GameEventListener> eventListeners = new List<GameEventListener>();