Tanoda
SimpleRendererUtil.cs
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) Ultraleap, Inc. 2011-2020. *
3 * *
4 * Use subject to the terms of the Apache License 2.0 available at *
5 * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6 * between Ultraleap and you, your company or other organization. *
7 ******************************************************************************/
8
9using System.Collections;
10using System.Collections.Generic;
11using UnityEngine;
12
13namespace Leap.Unity.Examples {
14
15 [RequireComponent(typeof(Renderer))]
16 public class SimpleRendererUtil : MonoBehaviour {
17
18 public Color activationColor = Color.yellow;
19
20 private Renderer _renderer;
21 private Material _materialInstance;
22
23 private Color _originalColor;
24
25 void Start() {
26 _renderer = GetComponent<Renderer>();
27 _materialInstance = _renderer.material;
28 _originalColor = _materialInstance.color;
29 }
30
31 public void SetToActivationColor() {
32 _materialInstance.color = activationColor;
33 }
34
35 public void SetToOriginalColor() {
36 _materialInstance.color = _originalColor;
37 }
38
39 public void ShowRenderer() {
40 _renderer.enabled = true;
41 }
42
43 public void HideRenderer() {
44 _renderer.enabled = false;
45 }
46
47 }
48
49}
UnityEngine.Color Color
Definition: TestScript.cs:32