- Home /
Glow (Area Light) disappears when touched ?
Hey guys,
I have an important question and I would really appreciate all of the help. We made an easy First Person Platform game in Unity and on the platform Hierarchy are a lot of Crystals, called: Crystal0, Crystal1 etc.. and each crystal is linked/inside with (Area light, Sprakle Rising) YOu know that kinda stuff 'models/effects for the crystals' that's all made in Cinema 4D. And it does work all fine..
Hierarchy:

Inspector Area Light:

So.. the question is, when you touch one of the crystals, that the 'Area Light' (thats the crystal which emits glow) inside the crystal disappears. (getting off the stage)
How can I do that ? (with code would be even more appreciated)
Thanks for all the help!
TCulter
Answer by justinpatterson · Mar 07, 2013 at 09:34 PM
If this is still an open issue, you could do the following:
Add a script to Crystal0 that calls in the light you want to disappear.
var targetLight:Light;
This declaration comes before Start(){} method (and you drag the light into the variable within the inspector).
Then you can go back to the Crystal0 script and create a collision method:
OnCollisionEnter(c:Collision){ if(c.gameObject.tag == "Player"){ DoSomething(); } }
If you really just want to destroy the light, you can write in: if(c.gameObject.tag == "Player"){ Destroy(targetLight); }
Your answer