diff --git a/Assets/Scripts/RaccoonShowcase.cs b/Assets/Scripts/RaccoonShowcase.cs index 1da191fd..424a8a3e 100644 --- a/Assets/Scripts/RaccoonShowcase.cs +++ b/Assets/Scripts/RaccoonShowcase.cs @@ -23,6 +23,7 @@ public class RaccoonShowcase : Script [Range(-5, 5)] public List intList = new List(new int[] { 2, 8, 2, 6, 8, 0, 1 }); public List enumList = new List(new Light.Type[] { Light.Type.Point, Light.Type.Directional, Light.Type.Ambient }); + public List nullList; public FontAsset fontAsset; public MeshAsset mesh; public MaterialAsset matAsset; diff --git a/SHADE_Managed/src/Editor/Editor.cxx b/SHADE_Managed/src/Editor/Editor.cxx index 29e3da36..80c73d4f 100644 --- a/SHADE_Managed/src/Editor/Editor.cxx +++ b/SHADE_Managed/src/Editor/Editor.cxx @@ -189,6 +189,12 @@ namespace SHADE System::Type^ listType = field->FieldType->GenericTypeArguments[0]; RangeAttribute^ rangeAttrib = hasAttribute(field); System::Collections::IList^ iList = safe_cast(field->GetValue(object)); + if (iList == nullptr) + { + // Create if the list does not exist + iList = safe_cast(System::Activator::CreateInstance(field->FieldType)); + field->SetValue(object, iList); + } if (SHEditorUI::CollapsingHeader(Convert::ToNative(field->Name), &isHovered)) {