Skip to content

Instantly share code, notes, and snippets.

@Chillu1
Chillu1 / FullscreenGameView.cs
Last active May 16, 2025 13:08
FullscreenGameView utility, for automatic fullscreen on play with toggle option (Game view fullscreen in editor)
/*
MIT License
Copyright (c) 2021 Chillu
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
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:
@dustingraham
dustingraham / ScriptableObjectWithId.cs
Created February 2, 2021 16:55
ScriptableObject with GUID
// Reference: https://github.com/Bunny83/UUID/blob/master/UUID.cs
using System;
using System.Collections.Generic;
using System.Globalization;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
#if UNITY_EDITOR
using System;
using System.Reflection;
using UnityEditor;
using UnityEngine;
/// <summary>
/// Little utility for opening a "Game" view in fullscreen. Will be opened on whatever Unity thinks is the "main"
/// monitor at the moment. The hotkey will toggle the window; however, if for some reason this breaks, fullscreen
@BrodyB
BrodyB / SceneViewControlWindow.cs
Created December 30, 2019 21:18
How to make a Unity EditorWindow take and swallow input from the Scene View!
using UnityEditor;
using UnityEngine;
/// <summary>
/// This window shows how you can listen for and consume user input events
/// from the Scene View. Super useful for making editor tools!
/// </summary>
public class SceneViewControlWindow : EditorWindow
{
/// <summary>
@noisecrime
noisecrime / ResourceChecker.cs
Last active April 2, 2025 17:05
Unity: Quick update to original 'Unity-Resource-Checker' to use native Unity methods for obtaining the memory size of textures.
// Resource Checker
// (c) 2012 Simon Oliver / HandCircus / hello@handcircus.com
// (c) 2015 Brice Clocher / Mangatome / hello@mangatome.net
// Public domain, do with whatever you like, commercial or not
// This comes with no warranty, use at your own risk!
// https://github.com/handcircus/Unity-Resource-Checker
// (c) 2019 NoiseCrime
// Quick update to use native Unity methods to obtain the size of textures.
// Looking through the code much has changed since this class was first created
// as such it requires a full rewrite to fix various issues and robustly deal
using System;
using System.Reflection;
using UnityEngine;
/// Access Unity.Recorder window through reflection
public static class RecordingExtensions
{
/// Start recording video using settings from the Recorder window
public static void StartRecording() => StartStopRecording("StartRecording");
@roguesleipnir
roguesleipnir / ShaderOccurence.cs
Last active August 2, 2022 11:18
Material/Shader reference searcher. Find materials that use a shader by name string. Find materials with missing shader or errors. Original snippet from https://answers.unity.com/questions/510945/find-materials-that-use-a-certain-shader.html
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
using System.IO;
//https://answers.unity.com/questions/510945/find-materials-that-use-a-certain-shader.html
public class ShaderOccurenceWindow : EditorWindow {
[MenuItem ("Tools/Shader Occurence")]
public static void Open () {
@aholkner
aholkner / ScenesMenuBuild.cs
Last active April 29, 2021 11:58
Unity editor extension to allow for quick scene switching from menu
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
/// Add a `Scenes` menu to Unity editor for quick access to all scenes in project.
///
@aholkner
aholkner / SerializedPropertyExtensions.cs
Last active June 12, 2025 14:28
Unity editor extension providing value get/set methods for SerializedProperty. This simplifies writing PropertyDrawers against non-trivial objects.
/* MIT License
Copyright (c) 2022 Alex Holkner
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: