Skip to content

Instantly share code, notes, and snippets.

@popcron
popcron / UITester.cs
Last active April 17, 2026 17:44
UIToolkit drawn manually
using System;
using System.Reflection;
using UnityEngine;
using UnityEngine.UIElements;
[ExecuteAlways]
public class UITester : MonoBehaviour
{
public Color backgroundColor = Color.red;
public Color fontColor = Color.white;
@popcron
popcron / BasicCircleImage.cs
Created April 30, 2023 20:18
Can draw a circle/square with roundedness settings per each corner
#nullable enable
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Game
{
[ExecuteAlways]
public class BasicCircleImage : MaskableGraphic
@popcron
popcron / PlayerLoopExtensions.cs
Last active April 7, 2026 01:02
Extensions for adding callbacks into Unity's player loop
using System;
using UnityEngine.LowLevel;
public static class PlayerLoopExtensions
{
public static int AddCallback(this ref PlayerLoopSystem system, Action function, Type systemType = null)
{
int index = system.subSystemList.Length;
PlayerLoopSystem[] subsystemList = new PlayerLoopSystem[index + 1];
Array.Copy(system.subSystemList, subsystemList, system.subSystemList.Length);
@popcron
popcron / CustomPlayBehaviour.cs
Last active May 26, 2022 01:31
Custom code before play
using System;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
namespace blablalblalmao
{
[InitializeOnLoad]
@popcron
popcron / EditorCustomCamera.cs
Created February 9, 2019 21:53
Variable editor camera FOV
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;
namespace Popcron.UnityEditor