Created
January 25, 2016 01:29
-
-
Save shinriyo/60695aa652ac9a8dabae to your computer and use it in GitHub Desktop.
UIWidgetのdepth値をいじるときのショートカット。 1増やす・・・Control + Shift + k 1減らす・・・Control + Shift + j
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
namespace EditorUtil | |
{ | |
/// <summary> | |
/// 便利メソッド. | |
/// </summary> | |
public class CustomMethods | |
{ | |
/// <summary> | |
/// Widgetのdepthを1増やす1減らす. | |
/// ショートカット: Control + Shift + k. | |
/// </summary> | |
[MenuItem("NGUI/Set depth #&k")] | |
static void IncrementDepth() | |
{ | |
ModifyDepth(1); | |
} | |
/// <summary> | |
/// Widgetのdepthを1減らす. | |
/// ショートカット: Control + Shift + j. | |
/// </summary> | |
[MenuItem("NGUI/Set depth #&j")] | |
static void DecrementDepth() | |
{ | |
ModifyDepth(-1); | |
} | |
static void ModifyDepth(int increment) | |
{ | |
var ogjs = Selection.objects; | |
if(ogjs.Length != 1) | |
{ | |
return; | |
} | |
var widget = (ogjs[0] as GameObject).GetComponent<UIWidget>(); | |
if(widget != null) | |
{ | |
widget.depth += increment; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment