[ExecuteInEditMode]
class Something {
void Update() {
if (Application.isPlaying) {
// code executed in play mode
} else {
// code executed in edit mode
}
}
}
#if UNITY_EDITOR
using UnityEditor;
#endif
[ExecuteInEditMode]
class Something {
void Update() {
#if UNITY_EDITOR
Debug.Log("Current scene name: " + EditorApplication.currentScene);
#endif
}
}
http://catlikecoding.com/unity/tutorials/editor/custom-list/

