Skip to content

Instantly share code, notes, and snippets.

View cemuka's full-sized avatar
🧙
Indie Game Developer

Cem Ugur Karacam cemuka

🧙
Indie Game Developer
View GitHub Profile
@StagPoint
StagPoint / OuterGlow.cs
Last active March 16, 2025 08:15
Custom VisualElement for Unity's UI Toolkit which is useful for creating an "outer glow" effect for buttons, or a "drop shadow" effect for popups, windows, and dialogs.
// Created 2024 StagPoint. Released to the public domain.
using System;
using System.Runtime.CompilerServices;
using Unity.Collections;
using UnityEngine;
using UnityEngine.Scripting;
using UnityEngine.UIElements;
@bgolus
bgolus / InfiniteGrid.shader
Last active November 20, 2024 01:20
Infinite Grid shader with procedural grid with configurable divisions and major and minor lines markings.
Shader "Unlit/InfiniteGrid"
{
Properties
{
[Toggle] _WorldUV ("Use World Space UV", Float) = 1.0
_GridScale ("Grid Scale", Float) = 1.0
_GridBias ("Grid Bias", Float) = 0.5
_GridDiv ("Grid Divisions", Float) = 10.0
_BaseColor ("Base Color", Color) = (0,0,0,1)
_LineColor ("Line Color", Color) = (1,1,1,1)
@tattyd
tattyd / Shadow.cs
Last active April 1, 2025 08:26
Soft shadow control for Unity UI Toolkit
/* MIT License
Copyright (c) 2022 David Tattersall
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@unitycoder
unitycoder / LineDrawer.cs
Created November 5, 2021 20:09
Drawing a line with Unity UI Toolkit
// Drawing a line with UITK https://forum.unity.com/threads/drawing-a-line-with-uitk.1193470/
public class LineDrawer : VisualElement
{
private Vector3 startPos, endPos;
private float thickness;
public LineDrawer(Vector3 pos1, Vector3 pos2, float width)
{
startPos = pos1;
endPos = pos2;
@davidfowl
davidfowl / MinimalAPIs.md
Last active March 16, 2025 16:47
Minimal APIs at a glance
@phosphoer
phosphoer / SpriteAtlasAsset.cs
Last active July 22, 2024 19:51
Unity Sprite Atlas Asset
// The MIT License (MIT)
// Copyright (c) 2024 David Evans @festivevector
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF O
@MattRix
MattRix / EmoPacker.cs
Last active April 28, 2025 10:02
Packing a folder of images into a sprite atlas for use with TextMeshPro
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Linq;
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
@rzubek
rzubek / Characters.cs
Created December 27, 2017 20:40
Unity C# script loading at runtime
// note: this interface will be referenced in loaded source code:
public interface ICharacter
{
int Height { get; }
string Language { get; }
}
public class Human : ICharacter
{
public int Height { get { return UnityEngine.Random.Range(150, 200); } }