public override void HandleEditorEndState(FreeEditorState state)
 {
     if (state == FreeEditorState.Playing)
     {
         UnsubscribeFromEditorUpdate();
     }
 }
    public static string[] OnWillSaveAssets(string[] paths)
    {
        FreeEditorState state = editorState.GetState();

        editorState.SetState(FreeEditorState.IsSaving);

        editorState.SetState(state);

        return(paths);
    }
    public override void HandleEditorUpdate(FreeEditorState state)
    {
        if (ShouldCapture())
        {
            CaptureProgress(false, true);

            RestartCapture();
        }
        else if (ShouldCaptureNoUI())
        {
            CaptureProgress(false, false);

            _nextNoUICaptureTime = _nextCaptureTime + 1f;
        }
    }
    static void HandleEditorStateChanged()
    {
        FreeEditorState currentState = editorState.GetState();

        if (EditorApplication.isCompiling)
        {
            editorState.SetState(FreeEditorState.IsCompiling);
        }
        else if (EditorApplication.isPlaying)
        {
            editorState.SetState(FreeEditorState.Playing);
        }
        else if (EditorApplication.isUpdating)
        {
            editorState.SetState(FreeEditorState.IsUpdating);
        }
        else if (EditorApplication.isPaused)
        {
            editorState.SetState(FreeEditorState.IsPaused);
        }
        else if (EditorApplication.isPlayingOrWillChangePlaymode)
        {
            if (currentState == FreeEditorState.Playing)
            {
                editorState.SetState(FreeEditorState.IsPaused);
            }
            else if (currentState == FreeEditorState.IsPaused)
            {
                editorState.SetState(FreeEditorState.Playing);
            }
            else
            {
                editorState.SetState(FreeEditorState.None);
            }
        }
        else
        {
            //Nothing is happening!
            editorState.SetState(FreeEditorState.None);
        }
    }
    static void EndEditorState(FreeEditorState state)
    {
        switch (state)
        {
        case FreeEditorState.IsCompiling:
        {
            break;
        }

        case FreeEditorState.IsPaused:
        {
            break;
        }

        case FreeEditorState.IsPlayingOrWillChangePlayMode:
        {
            break;
        }

        case FreeEditorState.IsUpdating:
        {
            break;
        }

        case FreeEditorState.None:
        {
            break;
        }

        case FreeEditorState.Playing:
        {
            break;
        }
        }

        for (int i = 0; i < stateSubscribers.Count; i++)
        {
            stateSubscribers [i].HandleEditorEndState(state);
        }
    }
    public override void HandleEditorBeginState(FreeEditorState state)
    {
                #if !TRACK_PROJECT
        return;
                #endif

        if (state == FreeEditorState.Playing)
        {
            _startPlayTime = Time.time;

            StartCapture();

            _nextNoUICaptureTime = _nextCaptureTime + 1f;

            SubscribeToEditorUpdate();
        }

        if (state == FreeEditorState.IsSaving)
        {
            CaptureProgress(true, true);
        }
    }
    static void BeginEditorState(FreeEditorState state)
    {
        switch (state) {

            case FreeEditorState.IsCompiling:
            {
                break;
            }
            case FreeEditorState.IsPaused:
            {
                break;
            }
            case FreeEditorState.IsPlayingOrWillChangePlayMode:
            {
                break;
            }
            case FreeEditorState.IsUpdating:
            {
                break;
            }
            case FreeEditorState.None:
            {
                break;
            }
            case FreeEditorState.Playing:
            {
                break;
            }

        }

        for (int i = 0; i < stateSubscribers.Count; i++) {

            stateSubscribers [i].HandleEditorBeginState (state);

        }
    }
 public abstract void HandleEditorUpdate(FreeEditorState state);
 public abstract void HandleEditorBeginState(FreeEditorState state);
	public override void HandleEditorUpdate (FreeEditorState state)
	{

		if (ShouldCapture ()) {

			CaptureProgress (false,true);

			RestartCapture ();

		}
		else if(ShouldCaptureNoUI()){

			CaptureProgress (false,false);

			_nextNoUICaptureTime = _nextCaptureTime + 1f;

		}


	}
	public override void HandleEditorEndState (FreeEditorState state)
	{

		if (state == FreeEditorState.Playing) {
			UnsubscribeFromEditorUpdate ();
		}
	}
	public override void HandleEditorBeginState (FreeEditorState state)
	{

		#if !TRACK_PROJECT

		return;

		#endif

		if (state == FreeEditorState.Playing) {

			_startPlayTime = Time.time;

			StartCapture ();

			_nextNoUICaptureTime = _nextCaptureTime + 1f;

			SubscribeToEditorUpdate ();

		}

		if (state == FreeEditorState.IsSaving) {

			CaptureProgress (true,true);

		}

	}