Fix Get/Set field node in Visual Script to update Instance box accordingly for static fields

This commit is contained in:
Wojtek Figat
2021-11-06 13:48:34 +01:00
parent 22fa954716
commit 6f68f4e5b0

View File

@@ -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);