To run in Play mode, place this attribute on the method:
xxxxxxxxxx
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
To have the method run when scripts are reloaded in the editor even outside of play mode:
xxxxxxxxxx
[UnityEditor.InitializeOnLoadMethod]