Skip to content

Instantly share code, notes, and snippets.

using System;
using UnityEngine;
public static class Extensions_Math
{
// ...
public static float VectorToRad(this Vector2 thisVec){
return Mathf.Atan2(thisVec.y, thisVec.x);
@jringrose
jringrose / InspectorButtonAttribute.cs
Last active June 1, 2018 00:37
A utility to open up temporary inspector windows to view objects. NewInspectorWindow.cs and InspectorButtonPropertyDrawer.cs should be inside an Editor folder.
using UnityEngine;
public class InspectorButtonAttribute : PropertyAttribute { }
@jringrose
jringrose / SceneHistoryWidget.cs
Last active May 5, 2024 13:19
Drop this into an Editor folder in your project to add a history widget to your scene view. Supports going backwards and forwards through your recent scene history, as well as a dropdown of all recently edited scenes. Also supports the back/forwards buttons on your mouse! Doesn't support multi-scene editing very well, though.
/*
MIT License
Copyright (c) 2016 Jesse Ringrose
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
@jringrose
jringrose / InspectorReadOnly.cs
Last active December 21, 2016 07:56
Use this InspectorReadOnly attribute for public fields that you want to easily inspect in the editor without allowing modifications. InspectorReadOnlyDrawer needs to be inside an Editor folder.
using System;
using UnityEngine;
// Usage:
//
// [InspectorReadOnly]
// public float someValue = 5f;
//
public class InspectorReadOnly : PropertyAttribute {
@jringrose
jringrose / FindProjectReferences.cs
Last active June 17, 2022 21:34
Unity editor extension that uses spotlight on OSX for lightning fast project reference searches. Asset serialization mode should be set to "Force Text" in the editor settings.
/*
MIT License
Copyright (c) 2016 Jesse Ringrose
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