Loading files
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Leap.Unity.AR.Testing {
public class ToggleComponentOnKey : MonoBehaviour {
public MonoBehaviour componentToToggle;
public bool startEnabled = true;
public KeyCode toggleKey = KeyCode.None;
private void Start() {
if (componentToToggle != null) {
componentToToggle.enabled = startEnabled;
}
}
private void Update() {
if (Input.GetKeyDown(toggleKey) && componentToToggle != null) {
componentToToggle.enabled = !componentToToggle.enabled;
}
}
}
}
4e10c4f05This file is pinned to the selected release. Download the original to open it in your design tool.