Fix scripts reload to auto-save any modified assets in editor windows
This commit is contained in:
@@ -167,7 +167,7 @@ namespace FlaxEditor.Surface
|
||||
bool hasTypeFromGameScripts = Editor.Instance.CodeEditing.AnimGraphNodes.HasTypeFromGameScripts;
|
||||
|
||||
// Check any surface parameter comes from Game scripts module to handle scripts reloads in Editor
|
||||
if (!hasTypeFromGameScripts)
|
||||
if (!hasTypeFromGameScripts && RootContext != null)
|
||||
{
|
||||
foreach (var param in Parameters)
|
||||
{
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
private void OnScriptsReloadBegin()
|
||||
{
|
||||
// Prevent any crashes due to dangling references to anim events
|
||||
_previewModel.ResetAnimation();
|
||||
_previewModel?.ResetAnimation();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -171,6 +171,11 @@ namespace FlaxEditor.Windows.Assets
|
||||
{
|
||||
if (!IsHidden)
|
||||
{
|
||||
if (IsEdited && _item != null)
|
||||
{
|
||||
Editor.Log($"Auto-saving local changes to asset '{_item.Path}' before reloading code");
|
||||
Save();
|
||||
}
|
||||
Editor.Instance.Windows.AddToRestore(this);
|
||||
Close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user