private void DrawModel(SampleModel model)
        {
            using (var horizontal = new EditorGUILayout.HorizontalScope())
            {
                if (model.Expanded)
                {
                    GUILayout.Label(model.Name);

                    foreach (var variant in model.Variants)
                    {
                        DrawModelLoadButton(variant.Name, variant.ModelFilePath);
                    }
                }
                else
                {
                    DrawModelLoadButton(model.Name, model.DefaultFilePath);
                }

                if (model.Variants.Count > 1)
                {
                    model.Expanded = DrawExpandCollapseButton(model.Expanded, model.Variants.Count);
                }
            }
        }
        private static SampleModel ParseSampleModel(JsonReader reader)
        {
            var result = new SampleModel();

            ParseStartObject(reader, "model");

            while (reader.TokenType != JsonToken.EndObject)
            {
                if (reader.TokenType != JsonToken.PropertyName)
                {
                    throw new Exception("Failed to parse model property");
                }
                var propertyName = reader.Value.ToString().ToLowerInvariant();
                reader.Read();

                switch (propertyName)
                {
                case "name":
                    result.Name = ParsePropertyValueAsString(reader, propertyName);
                    break;

                case "screenshot":
                    result.ScreenshotPath = ParsePropertyValueAsString(reader, propertyName);
                    break;

                case "variants":
                    Debug.Assert(!string.IsNullOrEmpty(result.Name), "Model index should have a name before a list of variants.");
                    result.Variants = ParseVariants(reader, result.Name);
                    break;
                }
            }

            ParseEndObject(reader, "model");

            return(result);
        }