Raycast and lightswitch
Hi. i'm trying to make an interaction raycast that let's me interact with door switch. But there is a problem. When i try to put a game object in my lightScript it remains empty.
" private bool open = false; public Light myLight;
public void ChangeLightState()
{
open = !open;
update();
}
void update()
{
if (open)
{
myLight.enabled = true;
}
else
{
myLight.enabled = false;
can you let me know what i've done wrong. Thank you.
Answer by alankemp · May 16, 2017 at 07:40 PM
Have you put your LightScript onto a gameobject in the scene?
I am able to now attach the "gameObject"(light) to the script.
Answer by Yuchemey · May 16, 2017 at 07:52 PM
i have put the lightScript onto a model that i have made, then made a gameObject with a light and trying to put the light onto said script and it doesnt let me. is it something in the script?
I have tried making an gameobject with the light script. but it does the same thing.
Your answer
Follow this Question
Related Questions
C# - Button doesn't go inactive after clicking another one but thats what I want 2 Answers
The buttons on my VR-controllers don't work. 0 Answers
Button bool doesn´t work correctly weird 1 Answer
on and off music button in unity 5 0 Answers
How to make pie menu options interact to OnMouseDown? 0 Answers