//----------------------------------------------------------------------------------------------------------------------

        bool DrawCacheSettings(SceneCachePlayer t)
        {
            bool     changed   = false;
            GUIStyle styleFold = EditorStyles.foldout;

            styleFold.fontStyle = FontStyle.Bold;

            t.foldCacheSettings = EditorGUILayout.Foldout(t.foldCacheSettings, "Player", true, styleFold);
            if (t.foldCacheSettings)
            {
                //Show Selector GUI. Check if we should reopen
                string fullPath           = t.GetSceneCacheFilePath();
                string prevNormalizedPath = AssetEditorUtility.NormalizePath(fullPath);

                string newNormalizedPath = EditorGUIDrawerUtility.DrawFileSelectorGUI("Cache File Path", "MeshSync",
                                                                                      prevNormalizedPath, "sc", OnSceneCacheFileReload);
                newNormalizedPath = AssetEditorUtility.NormalizePath(newNormalizedPath);

                if (newNormalizedPath != prevNormalizedPath)
                {
                    ChangeSceneCacheFileInInspector(t, newNormalizedPath);
                }

                if (!string.IsNullOrEmpty(fullPath) && !fullPath.StartsWith(Application.streamingAssetsPath))
                {
                    GUILayout.BeginHorizontal();
                    const float BUTTON_WIDTH = 50.0f;
                    if (GUILayout.Button("Copy", GUILayout.Width(BUTTON_WIDTH)))
                    {
                        string dstPath = Misc.CopyFileToStreamingAssets(fullPath);
                        ChangeSceneCacheFileInInspector(t, dstPath);
                    }
                    GUILayout.Label("Scene Cache file to StreamingAssets");
                    EditorGUILayout.LabelField("(RECOMMENDED)", EditorStyles.boldLabel);
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();
                    GUILayout.Space(15);
                }
                EditorGUILayout.Space();

                //Time Unit
                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "SceneCache: Time Unit",
                                                                  guiFunc: () => (SceneCachePlayer.TimeUnit)EditorGUILayout.Popup("Time Unit",
                                                                                                                                  (int)t.GetTimeUnit(), TIME_UNIT_ENUMS),
                                                                  updateFunc: (SceneCachePlayer.TimeUnit timeUnit) => {
                    t.SetTimeUnit(timeUnit);
                    t.ResetTimeAnimation();
                }
                                                                  );


                SceneCachePlayer.TimeUnit selectedTimeUnit = t.GetTimeUnit();

                if (selectedTimeUnit == SceneCachePlayer.TimeUnit.Seconds)
                {
                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "SceneCache: Time",
                                                                      guiFunc: () => (EditorGUILayout.FloatField("Time", t.GetTime())),
                                                                      updateFunc: (float time) => { t.SetTime(time); });

                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "SceneCache: Interpolation",
                                                                      guiFunc: () => (EditorGUILayout.Toggle("Interpolation", t.GetInterpolation())),
                                                                      updateFunc: (bool toggle) => { t.SetInterpolation(toggle); });
                }
                else if (selectedTimeUnit == SceneCachePlayer.TimeUnit.Frames)
                {
                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "SceneCache: Base Frame",
                                                                      guiFunc: () => ((SceneCachePlayer.BaseFrame)EditorGUILayout.Popup("Base Frame", (int)t.GetBaseFrame(), BASE_FRAME_ENUMS)),
                                                                      updateFunc: (SceneCachePlayer.BaseFrame baseFrame) => {
                        t.SetBaseFrame(baseFrame);
                        t.ResetTimeAnimation();
                    });

                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "SceneCache: Frame",
                                                                      guiFunc: () => (EditorGUILayout.IntField("Frame", t.GetFrame())),
                                                                      updateFunc: (int frame) => { t.SetFrame(frame); });
                }

                // preload
                {
                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "SceneCache: Preload",
                                                                      guiFunc: () => (EditorGUILayout.IntSlider("Preload Length", t.GetPreloadLength(), 0, t.frameCount)),
                                                                      updateFunc: (int preloadLength) => { t.SetPreloadLength(preloadLength); });
                }

                EditorGUILayout.Space();
            }

            return(changed);
        }
//----------------------------------------------------------------------------------------------------------------------

        void DrawCacheSettings()
        {
            GUIStyle styleFold = EditorStyles.foldout;

            styleFold.fontStyle = FontStyle.Bold;

            m_sceneCachePlayer.foldCacheSettings = EditorGUILayout.Foldout(m_sceneCachePlayer.foldCacheSettings, "Player", true, styleFold);
            if (m_sceneCachePlayer.foldCacheSettings)
            {
                //Show Selector GUI. Check if we should reopen
                string fullPath           = m_sceneCachePlayer.GetSceneCacheFilePath();
                string prevNormalizedPath = AssetUtility.NormalizeAssetPath(fullPath);

                string newNormalizedPath = EditorGUIDrawerUtility.DrawFileSelectorGUI("Cache File Path", "MeshSync",
                                                                                      prevNormalizedPath, "sc", OnSceneCacheFileReload);
                newNormalizedPath = AssetUtility.NormalizeAssetPath(newNormalizedPath);

                if (newNormalizedPath != prevNormalizedPath)
                {
                    ChangeSceneCacheFileInInspector(m_sceneCachePlayer, newNormalizedPath);
                }

                if (!string.IsNullOrEmpty(fullPath) && !fullPath.StartsWith(Application.streamingAssetsPath))
                {
                    GUILayout.BeginHorizontal();
                    const float BUTTON_WIDTH = 50.0f;
                    if (GUILayout.Button("Copy", GUILayout.Width(BUTTON_WIDTH)))
                    {
                        string dstPath = Misc.CopyFileToStreamingAssets(fullPath);
                        ChangeSceneCacheFileInInspector(m_sceneCachePlayer, dstPath);
                    }
                    GUILayout.Label("Scene Cache file to StreamingAssets");
                    EditorGUILayout.LabelField("(RECOMMENDED)", EditorStyles.boldLabel);
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();
                    GUILayout.Space(15);
                }
                EditorGUILayout.Space();


                EditorGUI.BeginChangeCheck();

                SceneCachePlayer.TimeUnit selectedTimeUnit = (SceneCachePlayer.TimeUnit)
                                                             EditorGUILayout.Popup("Time Unit", (int)m_sceneCachePlayer.GetTimeUnit(), m_timeUnitEnums);
                if (EditorGUI.EndChangeCheck())
                {
                    m_sceneCachePlayer.SetTimeUnit(selectedTimeUnit);
                    m_sceneCachePlayer.ResetTimeAnimation();
                }

                if (selectedTimeUnit == SceneCachePlayer.TimeUnit.Seconds)
                {
                    m_sceneCachePlayer.SetTime(EditorGUILayout.FloatField("Time", m_sceneCachePlayer.GetTime()));
                    m_sceneCachePlayer.SetInterpolation(EditorGUILayout.Toggle("Interpolation", m_sceneCachePlayer.GetInterpolation()));
                }
                else if (selectedTimeUnit == SceneCachePlayer.TimeUnit.Frames)
                {
                    EditorGUI.BeginChangeCheck();

                    SceneCachePlayer.BaseFrame selectedBaseFrame = (SceneCachePlayer.BaseFrame)
                                                                   EditorGUILayout.Popup("Base Frame", (int)m_sceneCachePlayer.GetBaseFrame(), m_baseFrameEnums);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_sceneCachePlayer.SetBaseFrame(selectedBaseFrame);
                        m_sceneCachePlayer.ResetTimeAnimation();
                    }

                    m_sceneCachePlayer.SetFrame(EditorGUILayout.IntField("Frame", m_sceneCachePlayer.GetFrame()));
                }

                // preload
                {
                    int preloadLength = EditorGUILayout.IntSlider("Preload Length", m_sceneCachePlayer.GetPreloadLength(), 0, m_sceneCachePlayer.frameCount);
                    m_sceneCachePlayer.SetPreloadLength(preloadLength);
                }

                EditorGUILayout.Space();
            }
        }