private void OnEnable()
 {
     skin       = (GUISkin)Resources.Load(EasyMotionConstants.pluginSkin);
     toggleIcon = (Texture2D)Resources.Load("toggle");
     easyMotionToggleControllers = EasyMotionUtility.FindActiveEnabledToggleControllers();
     availableToggles            = EasyMotionUtility.FindActiveToggles();
     GeneratePreviews();
     currentScene = SceneManager.GetActiveScene().name;
 }
 private void DestroyAllToggleControllers()
 {
     foreach (EasyMotionToggleController script in easyMotionToggleControllers)
     {
         DestroyImmediate(script);
     }
     easyMotionToggleControllers = EasyMotionUtility.FindActiveEnabledToggleControllers();
     EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
 }
    private bool FindAnyEasyMotionScript()
    {
        bool foundScript = false;

        EasyMotionToggleController[]             toggleScripts = EasyMotionUtility.FindActiveEnabledToggleControllers();
        EasyMotionSerialPortDropdownController[] portScripts   = EasyMotionUtility.FindActiveEnabledDropdownControllers();
        EasyMotion[] easyMotionScripts             = EasyMotionUtility.FindActiveEnabledEasyMotions();
        EasyMotionSliderController[] sliderScripts = EasyMotionUtility.FindActiveEnabledSliderControllers();

        if (toggleScripts.Length > 0 || portScripts.Length > 0 || easyMotionScripts.Length > 0 || sliderScripts.Length > 0)
        {
            foundScript = true;
        }
        return(foundScript);
    }
    private void DestroyAllScripts()
    {
        EasyMotionToggleController[]             toggleScripts = EasyMotionUtility.FindActiveEnabledToggleControllers();
        EasyMotionSerialPortDropdownController[] portScripts   = EasyMotionUtility.FindActiveEnabledDropdownControllers();
        EasyMotionSliderController[]             sliderScripts = EasyMotionUtility.FindActiveEnabledSliderControllers();

        foreach (EasyMotionToggleController toggleScript in toggleScripts)
        {
            DestroyImmediate(toggleScript);
        }
        foreach (EasyMotionSerialPortDropdownController portScript in portScripts)
        {
            DestroyImmediate(portScript);
        }
        foreach (EasyMotionSliderController sliderScript in sliderScripts)
        {
            DestroyImmediate(sliderScript);
        }
    }