Question by
Tyson1211 · Oct 03, 2015 at 03:55 PM ·
c#particlesystemflashlight
Flashlight with Partical help
I am creating a Flash light, and I wanted to have dust particals show when the light was enabled, how do I do that? Using my flash light script?
using UnityEngine;
using System.Collections;
public class FlashLight : MonoBehaviour
{
public bool FlashLightOn = false;
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown("FlashlightPower"))
{
if (FlashLightOn == true)
{
GameObject.Find("Light").GetComponent<Light>().enabled = true;
FlashLightOn = false;
Debug.Log("Light On");
}
else
{
GameObject.Find("Light").GetComponent<Light>().enabled = false;
FlashLightOn = true;
Debug.Log("Light Off");
}
}
}
}
Comment
Add a particel emitter in front of your flashlight and turn it on whenever you turn the flashlight on.