Skip to content

Instantly share code, notes, and snippets.

@AngryAnt
AngryAnt / DualDisplay.cs
Last active January 24, 2024 08:26
Example use of the Unity 4.1 AirPlay API - gives a setup with the iOS device as controller of the remote display.
using UnityEngine;
using System.Collections;
/*
Runtime use:
To be available, AirPlay needs to be switched on for the device either via a native AirPlay UI component or
via the global AirPlay mirroring setting. Your options are:
A: Modify your Xcode project to layer a native AirPlay Cocoa control somewhere over your Unity content.
@Minimally
Minimally / LayerMenu.cs
Created April 19, 2014 19:52
Unity Editor script for filtering layers via keyboard
using UnityEditor;
using UnityEngine;
public static class LayerMenu
{
/* PLACE IN EDITOR FOLDER.
* Feel free to change hotkeys depending on your preference.
* Modifier Keys % (ctrl on Windows, cmd on OS X), # (shift), & (alt), _ (no key modifiers) */
#region Layer Visibility
@nicoplv
nicoplv / PlayMode.cs
Last active February 27, 2024 03:15
Full screen game view on Unity editor (works only with 2017.2 or +)
using UnityEditor;
using UnityEngine;
namespace FullScreenPlayModes
{
[InitializeOnLoad]
public class FullScreenPlayMode : Editor
{
//The size of the toolbar above the game view, excluding the OS border.
private static int toolbarHeight = 22;
@TJHeuvel
TJHeuvel / CustomPrefabImporterEditor.cs
Last active November 9, 2019 18:30
Custom inspector window for Unity prefabs that allows you to (multi) edit them.
using UnityEditor;
using UnityEditor.Experimental.AssetImporters;
using UnityEngine;
using System.Reflection;
using System;
using System.Collections;
using System.Linq;
using Object = UnityEngine.Object;
using System.Collections.Generic;
@Srfigie
Srfigie / .gitattributes
Created February 2, 2020 14:30 — forked from nemotoo/.gitattributes
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@yasirkula
yasirkula / UnitypackageExtractor.cs
Last active July 8, 2024 21:35
Extract a .unitypackage to any directory (even outside the project folder) from within Unity
#define STOP_EXTRACTION_WHEN_WINDOW_CLOSED
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Reflection;
using System.Text;
using System.Threading;
using UnityEditor;
#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
@mukaschultze
mukaschultze / PreviewBackgroundColor.cs
Last active May 6, 2020 22:09
Change Unity preview background to a nicer color!
using UnityEditor;
using UnityEngine;
namespace EnhancedHierarchy {
[InitializeOnLoad]
static class PreviewBackgroundColor {
private static readonly Color backgroundColor = new Color(1f, 0f, 1f); // Change this color
static PreviewBackgroundColor() {
/*
A simple little editor extension to copy and paste all components
Help from http://answers.unity3d.com/questions/541045/copy-all-components-from-one-character-to-another.html
license: WTFPL (http://www.wtfpl.net/)
author: aeroson
advise: ChessMax
editor: frekons
*/
#if UNITY_EDITOR
@yasirkula
yasirkula / ConvertTexturesToPNG.cs
Last active July 22, 2024 14:18
Convert all TGA, TIFF, PSD and BMP (customizable) Textures to PNG to reduce the project size without any quality loss in Unity
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using UnityEditor;
using UnityEngine;
using Debug = UnityEngine.Debug;
using Object = UnityEngine.Object;