I've got a script that manages a custom mesh and needs to run in the editor. It works like intended, but changing the mesh (say by calling "GetComponent().sharedMesh.Clear()") causes the scene to set it's state to dirty (the * in the editor's titlebar shows up permanently and indicates a changed scene).
As I generate the mesh by code there's no reason for the user to save those changes, so is there a way to disable this behavior?
This must be possible somehow as the buildin ParticleSystem both runs in the editor and changes it's mesh without setting the scene dirty.
Update: I tried HideFlags.DontSave but without luck. As soon as I change some vertices the scene went dirty.
Update 2: Like tranquility suggested, I've tried the following:
[ExecuteInEditMode]
public class Meshtest : MonoBehaviour {
Mesh mMesh;
void OnEnable () {
mMesh = new Mesh(); // create a private mesh
}
void Update()
{
mMesh.Clear(); // scene will turn to dirty state
}
}
but even without any MeshFilter and MeshRenderer present in the scene it will turn to changed state immediately.