Skip to content

Instantly share code, notes, and snippets.

@shadesbelow
shadesbelow / ResettableScriptableObject.cs
Created May 11, 2023 14:09
A base class to make a Scriptable Object reset its values after exiting play mode
Using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class ResettableScriptableObject : ScriptableObject
{
public int Field1;
public float Field2;
public Vector2 Field3;
@shadesbelow
shadesbelow / InspectorLockToggle.cs
Created August 11, 2018 14:59
Hotkey for toggling inspector lock (hover mouse over inspector then press alt + q)
using System;
using System.Reflection;
using UnityEditor;
public class InspectorLockToggle
{
[MenuItem("Tools/Toggle Lock &q")]
static void ToggleInspectorLock() // Inspector must be inspecting something to be locked
{
EditorWindow inspectorToBeLocked = EditorWindow.mouseOverWindow; // "EditorWindow.focusedWindow" can be used instead
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
// This is only useful for spritesheets that need to be automatically sliced (Sprite Editor > Slice > Automatic)
public class AutoSpriteSlicer
{
[MenuItem("Tools/Slice Spritesheets %&s")]