How to serialized a variable in a c# method?

I was wondering how to serialized a field in a c# method so that I can change the variable through the Unity Inspector rather than having to constantly go back to the code to change it. I know how to do this for class variables ([Serialize Field] or make the variable public) but when I try to do it for in-method variables I get an error.

Oh, sorry, misread your question.

Short answer is you cannot expose anything that isn’t in the class global scope directly.

In C# it wouldn’t make any sense if you tried, since everything defined within a method is a temporary variable that only exists as long as the method is executing.

Why not put the value in a global scope public field and then instantiate your method variable (stack variable) from it?