Clear VisjectSurface node caches and context menus during scripts reload

This commit is contained in:
2024-04-23 21:38:42 +03:00
parent 83b301684d
commit bdb28b8589
4 changed files with 29 additions and 2 deletions

View File

@@ -19,6 +19,8 @@ namespace FlaxEditor.Surface
[HideInEditor]
public class AnimGraphSurface : VisjectSurface
{
private static NodesCache _nodesCache = new NodesCache(IterateNodesCache);
private static readonly List<GroupArchetype> StateMachineGroupArchetypes = new List<GroupArchetype>(new[]
{
// Customized Animations group with special nodes to use here
@@ -87,8 +89,6 @@ namespace FlaxEditor.Surface
}
};
private static NodesCache _nodesCache = new NodesCache(IterateNodesCache);
/// <summary>
/// The state machine editing context menu.
/// </summary>
@@ -158,6 +158,8 @@ namespace FlaxEditor.Surface
private void OnScriptsReloadBegin()
{
_nodesCache.Clear();
// Check if any of the nodes comes from the game scripts - those can be reloaded at runtime so prevent crashes
bool hasTypeFromGameScripts = Editor.Instance.CodeEditing.AnimGraphNodes.HasTypeFromGameScripts;