Skip to content

Instantly share code, notes, and snippets.

@toxicFork
Last active August 29, 2015 14:07
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 toxicFork/097df5144fd824647404 to your computer and use it in GitHub Desktop.
Save toxicFork/097df5144fd824647404 to your computer and use it in GitHub Desktop.
[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")) {
//PerformSlice();
}
GUI.enabled = enabled;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment