Newer
Older
HoloAnatomy / Assets / HoloToolkit / Utilities / Scripts / AtlasReferenceUpdater / Editor / Extensions / SerializedPropertyExtensions.cs
SURFACEBOOK2\jackwynne on 25 May 2018 670 bytes v1
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

namespace HoloToolkit.Unity
{
    public static class SerializedPropertyExtensions
    {
        public static void SetObjects<T>(this SerializedProperty property, IList<T> objects) where T : Object
        {
            property.arraySize = objects.Count;
            for (var i = 0; i < objects.Count; i++)
            {
                property.GetArrayElementAtIndex(i).objectReferenceValue = objects[i];
            }
        }
    }
}