void OnDisable()
    {
        _engine.RemoveOnCompilationFailedHandler(OnCompilationFailedAction);
        _engine.RemoveOnCompilationSucceededHandler(OnCompilationSucceededAction);

        _engine.UnloadDomain();
    }
        void OnDisable()
        {
            //OnDisable later then EventManager's OnApplicationQuit where It's Instance property gets nullified
            //That causes null reference exception, so let's add this check to prevent that
            if (EventManager.Instance != null)
            {
                _engine.RemoveOnCompilationSucceededHandler(OnCompilationSucceededAction);
                _engine.RemoveOnCompilationFailedHandler(OnCompilationFailedAction);
                _engineRemote.RemoveOnCompilationSucceededHandler(OnCompilationSucceededAction);
                _engineRemote.RemoveOnCompilationFailedHandler(OnCompilationFailedAction);

                EventManager.Instance.RemoveListener <CompilationEvent>(OnCompileButton);
                EventManager.Instance.RemoveListener <ExecutionEvent>(OnExecuteButton);
                EventManager.Instance.RemoveListener <CompileTypeEvent>(OnCompileAndAddTypeButton);
                EventManager.Instance.RemoveListener <DeleteTypeEvent>(OnDeleteTypeButton);
            }
            if (Remote)
            {
                if (_engineRemote.RemoteDomain != null)
                {
                    _engineRemote.Dispose();
                }
            }
        }