Based on another thread, didn’t quite feel I got a correct answer, so I created a new one
I’m trying to recreate a feature from the 2013 Unity horror game Slender: The Arrival, in which the player must activate six power generators. If the player clicks on a generator, the generator’s Point Light switches from red to green. I’m trying to replicate this using C# in Unity. Does anybody know how I can get the point light to switch from red to green upon being clicked on? If so, I’d greatly appreciate it if you could show me how. A little bit of code I can use to start off this script would be really helpful. Please and thanks in advance!
If you have two lights on the GameObject, as children most likely, and switch one off and the other on you’ll be able to adjust all the attributes of the light in the inspector.
public class Generator
{
public Light redLight;
public Light greenLight;
void Start() { redLight.SetActive(true); greenLight.SetActive(false); }
void TurnOn() { redLight.SetActive(false); greenLight.SetActive(true); }
}
Not to be rude, these games are kept really simple, yet you’re creating tons of threads (3 pages so far) about almost every single feature of said game (and similar ones), i mean… come on.
The community likes to help and everyone appreciates that, but you don’t even show alot of effort to learn programming by yourself and it almost looks as if you put your game together piece by piece with community-written code.