Newer
Older
HoloAnatomy / Assets / HoloToolkit-Examples / Prototyping / Scripts / CycleMaterials.cs
SURFACEBOOK2\jackwynne on 25 May 2018 711 bytes v1
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using UnityEngine;
using System.Collections;

namespace HoloToolkit.Examples.Prototyping
{
    /// <summary>
    /// sets the material of an object to a material selected in the array
    /// </summary>
    public class CycleMaterials : CycleArray<Material>
    {
        public override void SetIndex(int index)
        {
            base.SetIndex(index);

            Renderer renderer = TargetObject.GetComponent<Renderer>();
            if (renderer != null)
            {
                renderer.material = Current;
            }
        }
    }
}