private void FreezeObject()
 {
     if (objectToFreeze != null)
     {
         if (Input.GetButtonDown("Freeze"))
         {
             if (objectToFreeze.CurrentTimeState == TimeState.FROZEN)
             {
                 objectToFreeze.UnfreezeTime();
             }
             else
             {
                 objectToFreeze.FreezeTime();
             }
             //if (TimeObjectManager.FrozenObjects.Contains(objectToFreeze))
             //{
             //    objectToFreeze.UnfreezeTime();
             //    TimeObjectManager.FrozenObjects.Remove(objectToFreeze);
             //}
             //else
             //{
             //    objectToFreeze.FreezeTime();
             //    TimeObjectManager.FrozenObjects.Add(objectToFreeze);
             //}
         }
     }
 }
    public void CreateCustomGUI(TimeObject to)
    {
        base.OnInspectorGUI();

        GUIStyle colorChange = new GUIStyle(GUI.skin.label);

        colorChange.normal.textColor = to.CurrentTimeState == TimeState.RECORDING ? Color.red : Color.green;

        EditorGUILayout.BeginHorizontal();

        GUILayout.Label("● NOT RECORDING", colorChange);

        if (to.CurrentTimeState == TimeState.FROZEN)
        {
            if (GUILayout.Button(new GUIContent("▮▮", "Unfreeze Time Object"), new GUILayoutOption[] { GUILayout.Width(30), GUILayout.Height(20) }))
            {
                to.UnfreezeTime();
            }
        }
        else
        {
            if (GUILayout.Button(new GUIContent("▶", "Freeze Time Object"), new GUILayoutOption[] { GUILayout.Width(30), GUILayout.Height(30) }))
            {
                to.FreezeTime();
            }
        }

        if (GUILayout.Button(new GUIContent("◀◀", "Reverse Recording")))
        {
            to.ReverseTime(false);
        }

        if (GUILayout.Button(new GUIContent("▶▶", "Forward Recording")))
        {
            to.ForwardTime();
        }

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();

        if (GUILayout.Button(new GUIContent("START RECORDING", "Start regular recording")))
        {
            to.StartRecording();
        }

        if (GUILayout.Button(new GUIContent("START RECORDING ALL", $"Start ALL* recording {ALLRecording}")))
        {
            to.StartRecording(false, true);
        }

        if (GUILayout.Button(new GUIContent("CLEAR AND START RECORDING", "Clear recorded time point history and start recording")))
        {
            to.StartRecording();
        }

        if (GUILayout.Button(new GUIContent("CLEAR AND START RECORDING ALL", $"Clear recorded time point history and start ALL* recording {ALLRecording}")))
        {
            to.StartRecording(true, true);
        }

        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();

        if (GUILayout.Button(new GUIContent("END RECORDING", "END RECORDING")))
        {
            to.EndRecording();
        }

        if (GUILayout.Button(new GUIContent("CLEAR RECORDING", "CLEAR RECORDING")))
        {
            to.ClearTimeHistory();
        }

        if (GUILayout.Button(new GUIContent("SAVE RECORDING", "Save recording to a JSON file to be loaded later")))
        {
            TimeObject.SaveSerializedTimeObjectDelta(to);
        }

        if (GUILayout.Button(new GUIContent("LOAD RECORDING", "Load saved recording onto Time Object")))
        {
            to.LoadSerializedTimeObjectDelta();
        }

        EditorGUILayout.EndHorizontal();
    }