public static void EditorUpdate()
{
if (EditorApplication.isCompiling) {
Select(null);
if (Selection.activeGameObject && Selection.activeGameObject.GetComponent<MBObject>())
Selection.activeGameObject = null;
}
if (EditorApplication.isPlaying || !SelectedParticleSystem) return;
// Time.time & Time.deltatime won't run in editor, so set them here
if (!SelectedParticleSystem.Warping) {
float elapsedRealtime = (float)EditorApplication.timeSinceStartup-mRealTime;
mRealTime = (float)EditorApplication.timeSinceStartup;
SelectedParticleSystem.GlobalTime += elapsedRealtime * MBEditor.mSlowMotion;
SelectedParticleSystem.DeltaTime = SelectedParticleSystem.GlobalTime - LastEditorFrameTime;//Mathf.Min(SelectedParticleSystem.GlobalTime - LastEditorFrameTime, 1f);
LastEditorFrameTime = SelectedParticleSystem.GlobalTime; // last GT
//Old timing w/o slomotion:
//SelectedParticleSystem.GlobalTime = (float)EditorApplication.timeSinceStartup;
//SelectedParticleSystem.DeltaTime = Mathf.Min(SelectedParticleSystem.GlobalTime - LastEditorFrameTime,2f);
//LastEditorFrameTime = SelectedParticleSystem.GlobalTime;
}
if (SelectedParticleSystem.AutoPlay && !SelectedParticleSystem.Playing)
SelectedParticleSystem.Play();
SelectedParticleSystem.mbUpdate();
SelectedParticleSystem.mbRender();
if (!GameView)
GameView = MBEditorUtility.GetGameViewWindow();
if (GameView)
GameView.Repaint();
if (GameView && SceneView.focusedWindow == GameView)
SelectedParticleSystem.mbEditorCamera = null;
if (SceneView.lastActiveSceneView)
SceneView.lastActiveSceneView.Repaint();
}