Exemple #1
0
 static void Init()
 {
     if (EditorUtility.DisplayDialog("Update SpriteButtons", "Do you really want to update all spriteButtons?", "Update", "Cancel"))
     {
         SpriteButtonUtils.UpdateSpriteButtonsOnEditor(true);
     }
 }
    public override void OnInspectorGUI()
    {
        if (!EditorApplication.isPlaying)
        {
            SpriteButtonUtils.UpdateSpriteButtonsOnEditor(false);

            SpriteButton button = (SpriteButton)target;

            if (!button.anchor.Equals(SpriteButtonAnchor.NONE))
            {
                button.screenID = EditorGUILayout.IntField("Screen ID", button.screenID);
            }

            button.anchor = (SpriteButtonAnchor)EditorGUILayout.EnumPopup("Anchor", button.anchor);

            if (!button.anchor.Equals(SpriteButtonAnchor.NONE))
            {
                button.marginTop    = EditorGUILayout.FloatField("Margin Top", button.marginTop);
                button.marginBottom = EditorGUILayout.FloatField("Margin Bottom", button.marginBottom);
                button.marginLeft   = EditorGUILayout.FloatField("Margin Left", button.marginLeft);
                button.marginRight  = EditorGUILayout.FloatField("Margin Right", button.marginRight);
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty(target);
            }
        }
    }