12345678910111213141516171819202122232425262728293031 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- namespace Leap.Unity
- {
- public class KeyEnableGameObjects : MonoBehaviour
- {
- private void Update()
- {
- if (this.unlockHold != KeyCode.None && !Input.GetKey(this.unlockHold))
- {
- return;
- }
- if (Input.GetKeyDown(this.toggle))
- {
- foreach (GameObject gameObject in this.targets)
- {
- gameObject.SetActive(!gameObject.activeSelf);
- }
- }
- }
- public List<GameObject> targets;
- [Header("Controls")]
- public KeyCode unlockHold = KeyCode.RightShift;
- public KeyCode toggle = KeyCode.T;
- }
- }
|