Hello,
I’m following a tutorial on editor scripting (Editor Scripting - Unity Learn) and there’s a snippet of code that I find difficult to understand:
On line 9, the code uses the reserved keyword “using” but I don’t understand the purpose of using it here or even why is it being used similar as a function declaration ?
Any help will be deeply appreciated.
using UnityEditor;
[CustomEditor(typeof(Launcher))]
public class LauncherEditor : Editor
{
void OnSceneGUI()
{
// HERE IS MY QUESTION: Why using "using" like this:
using (new EditorGUI.DisabledGroupScope(!Application.isPlaying))
{
if (GUILayout.Button("Fire"))
{
// Do something
}
}
}
}