using UnityEditor;
using UnityEngine;
public static class BoxColliderContextMenu
{
[MenuItem( "CONTEXT/BoxCollider/Adjust To Match" )]
private static void AdjustToMatch( MenuCommand command )
{
var boxCollider = command.context as BoxCollider;
NGUITools.UpdateWidgetCollider( boxCollider, true );
}
[MenuItem( "CONTEXT/BoxCollider/Adjust To Match", true )]
private static bool CanAdjustToMatch( MenuCommand command )
{
var boxCollider = command.context as BoxCollider;
var uiWidget = boxCollider.GetComponent<UIWidget>();
return uiWidget != null;
}
}
関連記事