Skip to content

Instantly share code, notes, and snippets.

@shinriyo
Created January 25, 2016 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shinriyo/60695aa652ac9a8dabae to your computer and use it in GitHub Desktop.
Save shinriyo/60695aa652ac9a8dabae to your computer and use it in GitHub Desktop.
UIWidgetのdepth値をいじるときのショートカット。 1増やす・・・Control + Shift + k 1減らす・・・Control + Shift + j
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