I'm trying to code a script that makes a light flash when I left-click, because I'm trying to simulate a gun muzzle.
using UnityEngine;
using System.Collections;
public class LightFlash : MonoBehaviour {
public class LightIntensityDefault = 2;
public class LightFlashIntensity = float;
void Update ()
{
if(Input.GetMouseButtonDown("Fire2"))
LightFlashIntensity = 4;
WaitForEndOfFrame
LightFlashIntensity = LightIntensityDefault;
light.intensity = LightFlashIntensity;
}
}
↧