Skip to content

Instantly share code, notes, and snippets.

View sathyarajshetigar's full-sized avatar

Sathyaraj sathyarajshetigar

  • Ironjaw Studios Pvt. Ltd
View GitHub Profile
using UnityEngine;
using System.IO;
using System;
public static class RenderTextureExtensions
{
private static DefaultDictionary<RenderTexture, Texture2D> _cachedTextures = new DefaultDictionary<RenderTexture, Texture2D>();
@markeahogan
markeahogan / InspectorCapture.cs
Created August 3, 2023 07:02
Adds method to save the whole inspector to a screenshot
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
/// <summary>
/// Provides functionality for screenshotting full editor windows, and the inspector in particular
@FreyaHolmer
FreyaHolmer / GpuPrinter.cginc
Last active March 16, 2025 05:51
A unity shader .cginc to draw numbers in the fragment shader - see the first comment below for example usage!
///////////////////////////////////////////////////////////////////////////////
// ABOUT: A unity Shader .cginc to draw numbers in the fragment shader
// AUTHOR: Freya Holmér
// LICENSE: Use for whatever, commercial or otherwise!
// Don't hold me liable for issues though
// But pls credit me if it works super well <3
// LIMITATIONS: There's some precision loss beyond 3 decimal places
// CONTRIBUTORS: yes please! if you know a more precise way to get
// decimal digits then pls lemme know!
// GetDecimalSymbolAt() could use some more love/precision
@MirzaBeig
MirzaBeig / SimpleAudioGenerator.cs
Created August 15, 2024 03:52
A simple procedural audio (pure sine wave) generator for Unity, using OnAudioFilterRead().
using UnityEngine;
// MB: Simple procedural audio generator.
// Generates a pure sine wave/tone at a given frequency.
public class SimpleAudioGenerator : MonoBehaviour
{
int outputSampleRate;
const float TAU = Mathf.PI * 2.0f;
@runevision
runevision / BurstSDFGenerator.cs
Created September 11, 2024 07:48
Signed Distance Field generator for Unity with Burst support
/*
Based on the Anti-aliased Euclidean distance transform described by Stefan Gustavson and
Robin Strand. For further information, see https://contourtextures.wikidot.com/ and
https://web.archive.org/web/20220503051209/https://weber.itn.liu.se/~stegu/edtaa/
The algorithm is an adapted version of Stefan Gustavson's code, it inherits the copyright
statement below, which applies to this file only.
The rewrite with Unity Burst support makes the execution 40 times faster by default,
and 75 times faster if the passed in textures are both of type TextureFormat.RGBAFloat.
@yasirkula
yasirkula / CommentComponent.cs
Created November 4, 2024 19:15
Adding comments to Inspector via a component in Unity
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
[AddComponentMenu("Comment")]
public class CommentComponent : MonoBehaviour
{
#if UNITY_EDITOR
[SerializeField]
@FUJI-bayashi
FUJI-bayashi / RenameByAttachedImage.cs
Created April 15, 2025 21:29
Renames selected GameObjects in the Hierarchy based on their attached Sprite names from Image or SpriteRenderer components.
using UnityEngine;
using UnityEngine.UI;
using UnityEditor;
public static class RenameByAttachedImage
{
/// <summary>
/// Called from the right-click context menu in the Hierarchy when objects are selected
/// </summary>
[MenuItem("GameObject/Rename By Attached Image", false, 0)]