Only show GUI button if in Play mode
Right now I have an Editor Script
with the function OnInspectorGUI
.
In my function I draw a GUILayout.Button
, but I only want to draw that button if it's in the Play mode
. I don't want it to run while editing.
How do I achieve this?
Comment
Best Answer
Answer by afonsolfm · Aug 19, 2016 at 03:01 PM
Application.isPlaying
does the job.
Thanks for the answer, it was useful to me. I used it this way: public override void OnInspectorGUI() { DrawDefaultInspector(); if (Application.isPlaying) { //Put buttons and stuff here... } }
Your answer
Follow this Question
Related Questions
How to create an if statement for each element within a list C# 2 Answers
Unity 5.1 GUI mask disappears in Android build 0 Answers
Adjusting content display. 0 Answers
Unity Dropdown Menu Not Closing 1 Answer