Last active
December 21, 2018 05:51
-
-
Save dimmduh/ab8b28e72748784acedb19a6f0c208d5 to your computer and use it in GitHub Desktop.
To any Editor folder - Ctrl + Shift + X - cut/paste ; Ctrl + G - no parent
This file contains hidden or 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; | |
using UnityEditor; | |
using UnityEngine; | |
namespace IOGames.Utils | |
{ | |
public class IOEditorUtils | |
{ | |
[MenuItem("IO Games/Удалить Player Prefs", false, -1)] | |
public static void DeletePlayerPrefs() | |
{ | |
PlayerPrefs.DeleteAll(); | |
} | |
[MenuItem("IO Games/Увеличить кеш превью", false, -1)] | |
public static void Delete() | |
{ | |
AssetPreview.SetPreviewTextureCacheSize(10000000); | |
} | |
[MenuItem("IO Games/Очистить память", false, -1)] | |
public static void ClearMemory() | |
{ | |
EditorUtility.UnloadUnusedAssetsImmediate(); | |
GC.Collect(); | |
} | |
private static GameObject[] cutGameObjects; | |
[MenuItem("IO Games/Hotkeys/CutAndPaste %#x", false, -1)] | |
public static void CutAndPaste() | |
{ | |
//cut | |
if (cutGameObjects == null) | |
{ | |
cutGameObjects = Selection.gameObjects; | |
} | |
else | |
{ | |
//paste | |
var parent = Selection.activeGameObject ? Selection.activeGameObject.transform : null; | |
foreach (var go in cutGameObjects) | |
{ | |
Undo.SetTransformParent(go.transform, parent, "Change parent"); | |
go.transform.SetAsFirstSibling(); | |
} | |
cutGameObjects = null; | |
} | |
} | |
[MenuItem("IO Games/Hotkeys/NoParent %g", false, -1)] | |
public static void NoParent() | |
{ | |
if (Selection.gameObjects.Length > 0) | |
{ | |
foreach (var go in Selection.gameObjects) | |
{ | |
Undo.SetTransformParent(go.transform, null, "Set no parent"); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment