This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---------------------------------------------------------------------------- | |
// Author: Siarhei Pilat | |
// Site: https://www.suasor-ab.com/ | |
// This gist: https://gist.github.com/SiarheiPilat/b1469fba1b4f5757b10c083e88dbedb2 | |
// Updated: 24 Feb 2021 | |
// ---------------------------------------------------------------------------- | |
using UnityEditor; | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
/// <summary> | |
/// | |
/// Copies the pivot coordinates of a first slice of the spritesheet and applies them to the pivots of other slices in the same spritesheet. | |
/// This script only works for spritesheets that were sliced using the grid option. | |
/// How to: select your spritesheet in the project files and go to the menu item to run the command. | |
/// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
/// <summary> | |
/// Copies pivot from one sprite to another. | |
/// Adapted from: https://forum.unity.com/threads/copy-spritesheet-slices-and-pivots-solved.301340/ | |
/// </summary> | |
[CanEditMultipleObjects] | |
public class SpritePivotCopier : EditorWindow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
/// <summary> | |
/// The following script converts camera viewport corners' coordinates from viewport to world space. | |
/// </summary> | |
public class ScreenCornersToWorld : MonoBehaviour | |
{ | |
public Camera Camera; | |
public Vector3 BottomLeftCorner, TopLeftCorner, TopRightCorner, BottomRightCorner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Unity animation events or AnimationUtility API does not contain methods for deleting animation clip events at runtime.The following code makes it possible. | |
/// Taken from (with a minor bug fix): https://forum.unity.com/threads/remove-animation-event.78957/ | |
/// </summary> | |
public static void RemoveEventFromAnimator(string functionName, Animator animator) | |
{ | |
AnimatorClipInfo animationClipInfo = animator.GetCurrentAnimatorClipInfo(0)[0]; | |
AnimationClip animationClip = animationClipInfo.clip; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
public class InternalEditorWindowsTracker : MonoBehaviour | |
{ | |
/// <summary> | |
/// Get all currently open editor windows including default Unity windows, custom editors and windows that are tabbed. | |
/// Found here: https://answers.unity.com/questions/1237463/how-do-i-get-a-reference-to-the-default-editor-win.html?_ga=2.133529742.1822843399.1574452927-44739247.1572947128 | |
/// </summary> | |
public static EditorWindow[] GetAllOpenEditorWindows() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.Reflection; | |
public class InternalEditorWindowsChecker : MonoBehaviour | |
{ | |
/// <summary> | |
/// Most built-in editor windows in Unity are internal classes, so we can't access them directly. | |
/// However, we can work around that using Reflection. | |
/// The following code returns all editor window types, including internal classes (default Unity editor windows) and custom editor windows that are found in loaded assemblies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.Reflection; | |
public class ActiveEditorWindowValidator : MonoBehaviour | |
{ | |
/// <summary> | |
/// Checks whether an active window is a window that you require, for example: ValidateEditorWindow("UnityEditor.AnimationWindow"); | |
/// </summary> | |
bool ValidateEditorWindow(string EditorWindowType) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.IO; | |
public static class ScriptableObjectUtility | |
{ | |
/// <summary> | |
/// Create, name and place unique new ScriptableObject asset files. | |
/// Taken from: https://wiki.unity3d.com/index.php/CreateScriptableObjectAsset | |
/// </summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEditor.SceneManagement; | |
using UnityEngine; | |
// Credit goes to Comp-3 Interactive, thanks for sharing the script! | |
// This tiny class will Autosave your project whenever you play your scene! | |
[InitializeOnLoad] | |
public class Autosave | |
{ |
OlderNewer