diff --git a/Source/Editor/Scripting/TypeUtils.cs b/Source/Editor/Scripting/TypeUtils.cs index 60f64ab8e..3d6362d5d 100644 --- a/Source/Editor/Scripting/TypeUtils.cs +++ b/Source/Editor/Scripting/TypeUtils.cs @@ -37,8 +37,9 @@ namespace FlaxEditor.Scripting /// Gets the default value for the given type (can be value type or reference type). /// /// The type. + /// Whether the value can be empty. If that's true, it can't. /// The created instance. - public static object GetDefaultValue(ScriptType type) + public static object GetDefaultValue(ScriptType type, bool notNull = false) { if (type.Type == typeof(string)) return string.Empty; @@ -64,7 +65,7 @@ namespace FlaxEditor.Scripting Utilities.Utils.InitDefaultValues(value); return value; } - if (new ScriptType(typeof(object)).IsAssignableFrom(type)) + if (!notNull && new ScriptType(typeof(object)).IsAssignableFrom(type)) return null; if (type.CanCreateInstance) {