From 6f68f4e5b083199d21cf3cf72b3cbd924b2a0060 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 6 Nov 2021 13:48:34 +0100 Subject: [PATCH] Fix Get/Set field node in Visual Script to update Instance box accordingly for static fields --- Source/Editor/Surface/Archetypes/Function.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Source/Editor/Surface/Archetypes/Function.cs b/Source/Editor/Surface/Archetypes/Function.cs index 141028081..1fd061dcc 100644 --- a/Source/Editor/Surface/Archetypes/Function.cs +++ b/Source/Editor/Surface/Archetypes/Function.cs @@ -1762,17 +1762,19 @@ namespace FlaxEditor.Surface.Archetypes _isTypesChangedEventRegistered = true; Editor.Instance.CodeEditing.TypesChanged += UpdateSignature; } - var typeName = (string)Values[2]; - var isStatic = (bool)Values[3]; ScriptType type; + bool isStatic; if (fieldInfo) { type = fieldInfo.ValueType; + isStatic = fieldInfo.IsStatic; SetValue(2, type.TypeName); - SetValue(3, type.IsStatic); + SetValue(3, isStatic); } else { + var typeName = (string)Values[2]; + isStatic = (bool)Values[3]; type = TypeUtils.GetType(typeName); } if (type) @@ -1851,17 +1853,19 @@ namespace FlaxEditor.Surface.Archetypes _isTypesChangedEventRegistered = true; Editor.Instance.CodeEditing.TypesChanged += UpdateSignature; } - var typeName = (string)Values[2]; - var isStatic = (bool)Values[3]; ScriptType type; + bool isStatic; if (fieldInfo) { type = fieldInfo.ValueType; + isStatic = fieldInfo.IsStatic; SetValue(2, type.TypeName); - SetValue(3, type.IsStatic); + SetValue(3, isStatic); } else { + var typeName = (string)Values[2]; + isStatic = (bool)Values[3]; type = TypeUtils.GetType(typeName); } AddBox(false, 2, 0, string.Empty, new ScriptType(typeof(void)), false);