How to get variables of the script show in unity editor/inspector?

How to get variables of the script show in unity editor/inspector?

[SerializeField] before the variable will make it visible in the editor. You can do this to make private members visible and is usually preferable.

If variables are declared "public" they will show up in the inspector.