Code : Tout sélectionner
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TorchScript : MonoBehaviour {
// Use this for initialization
void Start () {
GetComponent.<light>.enabled = true;
}
// Update is called once per frame
void Update () {
if ((Input.GetKey("f")) && (GetComponent.< light >.enabled = false)
{
GetComponent.< light >.enabled = true;
}
if ((Input.GetKey("f")) && (GetComponent.< light >.enabled = true)
{
GetComponent.< light >.enabled = false;
}
}
}
.