Code to work in editor vs builds

I am implementing a standard “save” feature where the user can press Ctrl+s and save; however, while I’m testing this, i can’t use ctrl+s because Unity thinks I’m trying to save during play mode. Is there a way I can do ctrl+s in a build and ctrl+shift+s in the editor? This way I don’t have to change it every time I make a build?

Thanks!

Use preprocessor directives:

#if UNITY_EDITOR

#else

#endif