How to presist data (stop and play) of a static class accessed by an editor script ?

Hi everyone,
I read through several examples and questions in the forum but didn’t find a solution, because the examples does not working or facing a different solution-

I fill some references into a public static list<> EventSamplerRefList by an editor script. Several instances of the SamplerFixed.cs exist.These data of EventSamplerRefList should persist start/stop/build and restarting Unity.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[System.Serializable]
public class ManagerEventSamples{
    [SerializeField]
    public static List<EventSampleData> EventSamplerRefList = new List<EventSampleData>();
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
#endif
   [System.Serializable]
   [SerializeField]
   public class EventSampleData {
       public string evtName = "";
       public ushort evtType = 0;
       public double percent;
       public Transform trackSideGO = null;
       public short evtOP1 = 0;
       public EventSampleData() {
       }
   }
using UnityEngine;
using System.Collections;
using UnityEditor;
using UnityEditor.SceneManagement;

[System.Serializable]
[CustomEditor(typeof(SamplerFixed))]
public class SamplerEditor : Editor
   if (GUILayout.Button("Add(EventSample)")) {
       SamplerFixed sampler = (SamplerFixed)target;
        ......
       var eventSample = new EventSampleData();
       ManagerEventSamples.EventSamplerRefList.Add(eventSample);

       // Force serialization
       EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
   }
}

The list EventSamplerRefList exist as gobal access to several data by reference.
Does anyone have solution how to solve this?

Thanks a lot!

I don’t think what you’re asking is possible. You’ll have to attach your list to some sort of object, either an asset or scriptable object or something, that Unity could actually serialize and store in the project. It can’t (as far as I know) just save a static list without a binding object.

Yes, serialization is not possible with static data fields.

Hmm… after play and stop, the EventSamplerRefList is not empty but none valid references are found.

Perhaps is a logical issue. Would it possible that the references are stored in the static EventSamplerRefList are internal completely renewed in the objects on play, so there is generally no way to store references?