- Home /
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!
Answer by Vicarian · Jun 06, 2018 at 07:50 PM
Use preprocessor directives:
#if UNITY_EDITOR
#else
#endif
Cool that's exactly what I was looking for. I just couldn't remember what it was called. Thanks!
Please mark this question as answered if it solved your problem.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
Initialising List array for use in a custom Editor 1 Answer
Texture swapped out works in editor but not in build 1 Answer