Tried hiding the text box like I suggested but yes, the rest of the inspector still runs slow when edited. So it's unfortunately got nothing to do with the visibility of properties, but ApplyModifiedProperties() itself.
"Removing all text in the main box before modifying properties and then restore text afterwards" just does not work, unfortunately. There are two ways to display the text box in the inspector:
EditorGUILayout.PropertyField(serializedObject.FindProperty("_text"));
stm.text = EditorGUILayout.TextArea(stm._text);The way these work is basically... the TextArea() function is both what displays the text in the inspector, and returns the string as modified by the player. It is impossible to display editable text to the player without this. I tried variants on this approach too, and it is unavoidable, if the text is edited directly and then marked as dirty so the value actually saves, the slowdown happens.
This unfortunately seems to be an issue with Unity's prefab system (text outside of an edited prefab is just fine to edit), and while I will keep thinking on this issue, I cannot think of any perfect workaround. If there is a solution, it will come to me later. This really really feels like a brick wall situation to me, and I can't figure out a way through at the moment, but plenty of ways around.
There are other comprehensive approaches which may be better-suited for your use-case:
1. A dialogue manager.
Instead of keeping text on the text mesh objects, they are stored elsewhere - a .txt file, a dialogue manager script, etc. Then, instead of showing specific overridden prefabs, load text to the prefab/object as needed in-game.
2. Presets over prefabs.
This is just a text renderer, so it's easy to configure one object to look exactly like another, so why use prefabs in the first place? I have a w.i.p. script that can remember settings for a given STM object (text size, color, material, etc) and easily share that between other STM objects that also have this prefab. I'm just using it internally right now, but if you wanted I could polish that up and send it your way. (The UX needs improvement, it otherwise works fine) It works by having multiple STM objects share a preset scriptableObject, and those settings on the preset can be updated later on. I was thinking of including it with the asset sometime.
I'm going to keep thinking on this issue, but it really seems like a Unity problem... It has a traceable date that it became an issue for people, and I see people talking about the issue generically on forums for the last 5 years with the generally-accepted solution just being "unpack your prefabs". I also personally cannot recommend storing your in-game wikis, tutorials, and tooltips directly on prefabs for anything outside of a jam game. (One mistake with prefabs and a large amount of data can be lost from prefab instance overrides) I *developed* STM for users like you, so I would really truly like to solve this, but I just can't see a direct solution at the moment and can only offer my own experience with Unity. So of course I am willing to fix this, I just can't think of any possible solution at the moment short of getting in contact with Unity to see what's going wrong. If anything comes up, I will of course implement it asap.