- Home /
Question by
FranBCGold · Feb 02, 2014 at 03:06 PM ·
lighttutorialmuzzleflash
How do i put lights with muzzleflash?
Guys I am making a FPS game in Unity 3D and I cant get the light to work with the muzzle flash. The muzzle flash Works fine, but the lights don't. HERE IS THE SCRIPT IM USING:
#pragma strict
var muzzleFlash : ParticleEmitter;
var lightOne : GameObject;
var lightTwo : GameObject;
function Start () {
Screen.showCursor = false;
muzzleFlash.emit = false;
lightOne.SetActiveRecursively(false);
lightTwo.SetActiveRecursively(false);
}
function Update () {
if(Input.GetButtonDown("Fire1"))
muzzleFlash.emit = true;
lightOne.SetActiveRecursively(true);
lightTwo.SetActiveRecursively(true);
if(Input.GetButtonUp("Fire1"))
muzzleFlash.emit = false;
lightOne.SetActiveRecursively(false);
lightTwo.SetActiveRecursively(false);
}
Comment
Wiki
Answer by VLunarFangV · Feb 02, 2014 at 03:19 PM
Have you assigned the lightOne and lightTwo to game objects with lights attatched? It's best recommended you also add a timer to destroy the game objects otherwise the place will stay lit forever!
I assigned the lights, but i didn't add a timer. Thanks, I'll try that!
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Flash light off on start 1 Answer
How to stop rendering light? 1 Answer
Heya again guys how about rotation and score board 0 Answers
gun muzzle flashes 2 Answers