Showing property in editor window

I am making my own control and want to make my properties(like property Step in code below) be visible through unity editor.

using System.Collections.Generic;
using UnityEngine;

public class UIToggleProgressBar : MonoBehaviour {
    //here comes references to other items
    public List<UIToggle> items = new List<UIToggle>();

    private int step;

    public int Step {
        get { return step; }
        set {
            step = value;
            UpdateView();
        }
    }

    private void UpdateView() {
        //Here I update view on step change
    }
}

In this implementation Step property is not visible in editor. Can I do this without making custom editor? Or can I make variable which reacts to it’s change and updates view?

Unity will display non-private FIELDS in the inspector, a property it can have issues with.

You may want to create custom classes to implement the behavior on a type(like you did with an UpdateView in a set.

Also, doing work in a get/set isn’t good form for a property, all calls with properties should be extremely light weight.

Also use the search function, same question, same answer.

Right now when u change a property in the editor you will need to call UpdateView via the context menu. There is a way to get it to automatically call via editor extensions, but that’s more work.

using System.Collections.Generic;
using UnityEngine;

public class UIToggleProgressBar : MonoBehaviour {
    //here comes references to other items
    public List<UIToggle> items = new List<UIToggle>();

[SerializeField]
    private int step;

    public int Step {
        get { return step; }
        set {
            step = value;
            UpdateView();
        }
    }
[ContextMenu("UpdateView")]
    private void UpdateView() {
        //Here I update view on step change
    }
}