Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 14:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
[SerializeField] private TextAsset xmlAsset;
public SpriteAlignment spriteAlignment = SpriteAlignment.Center;
public Vector2 customOffset = new Vector2(0.5f, 0.5f);
public void OnGUI() {
xmlAsset = EditorGUILayout.ObjectField("XML Source", xmlAsset, typeof (TextAsset), false) as TextAsset;
spriteAlignment = (SpriteAlignment) EditorGUILayout.EnumPopup("Pivot", spriteAlignment);
bool enabled = GUI.enabled;
if (spriteAlignment != SpriteAlignment.Custom) {
GUI.enabled = false;
EditorGUILayout.Vector2Field("Custom Offset", customOffset);
GUI.enabled = enabled;
if (xmlAsset == null) {
GUI.enabled = false;
if (GUILayout.Button("Slice")) {
GUI.enabled = enabled;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment