• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

XYTH - Can you make a creating Lights Tutorial

FastBurst

New member
Xyth you are the man right now on Unity and 7 Days - One thing I have been trying to figure out and can't for the life of me, is creating new lights. Example. I have a few models like traffic lights and street lights I would love to see being able to light up as a light source.

The problem is I have no idea how to get this to work for A17, can you provide a tutorial on how to do this?

 
Xyth you are the man right now on Unity and 7 Days - One thing I have been trying to figure out and can't for the life of me, is creating new lights. Example. I have a few models like traffic lights and street lights I would love to see being able to light up as a light source.
The problem is I have no idea how to get this to work for A17, can you provide a tutorial on how to do this?
I'm no xyth, but i know how to do what you are asking for. It's very easy. In unity create a light, make it a child of your game object in the prefab instance you want to have a light. Export prefab with assetbundle exporting script. That's it. That will create a new light.

 
I'm no xyth, but i know how to do what you are asking for. It's very easy. In unity create a light, make it a child of your game object in the prefab instance you want to have a light. Export prefab with assetbundle exporting script. That's it. That will create a new light.
But isn't there a lot more than that like where the light is coming from, the output source etc. where the light source illuminates from etc. I need to see a visual and what Tag it needs for it for it to work properly

 
But isn't there a lot more than that like where the light is coming from, the output source etc. where the light source illuminates from etc. I need to see a visual and what Tag it needs for it for it to work properly
Alright. Well my apologies if I'm wrong in this, but judging from your response I think you may need to just learn how lights work in video games, specifically unity engine. https://docs.unity3d.com/Manual/Lighting.html should answer most of your questions about the way lights work.

 
Lights dont need a special tag. Use T_Mesh_B if you want to interact with the light, such as pick it up, collide with it, etc.

 
Alright. Well my apologies if I'm wrong in this, but judging from your response I think you may need to just learn how lights work in video games, specifically unity engine. https://docs.unity3d.com/Manual/Lighting.html should answer most of your questions about the way lights work.
Thanks Khelldon, I never had a need or want for the lighting until now I have done some of the stuff with my custom blocks like the servers and all that - that have emissions but even that has changed from the version of Unity we used for A16 and now the version of Unity we use for A17. So that's is where I started to get confused. But again this is the first to where turning on or off a light would be where I am needing to see how that all works. I will check out the document link and see.

- - - Updated - - -

Lights dont need a special tag. Use T_Mesh_B if you want to interact with the light, such as pick it up, collide with it, etc.

Okay thanks xyth - I wasn't 100% sure if there was a specific tag for lights that we have to use to make them work. What I am working on is Traffic lights, I want some to be lit and some of course just not working at all (That one is easy)

 
It would be cool if you would animate the traffic light that is working so its green for a minute, then yellow for 5 seconds then red for a minute, then loop that animation.

 
It would be cool if you would animate the traffic light that is working so its green for a minute, then yellow for 5 seconds then red for a minute, then loop that animation.
Way too advanced for me at the moment, I am sure if I sit down I can figure that out, right now I would just have the Red light on and using the builtin blinking option in 7 Days to make that flash - kinda like when the traffic lights here when crap goes wrong all blink red lol

 
Last edited by a moderator:
Ok I am clearly not doing something right.

I added the class light etc. I get the Turn on/Turn off and nothing happens. However there must be something I am missing because if I Hold E I do not get that options menu for the lights. Also turning off and on doesn't do anything. All I can see is the emissive light nothing more. Doesn't light up an area or can be turned off or on.

 
Ok I am clearly not doing something right.
I added the class light etc. I get the Turn on/Turn off and nothing happens. However there must be something I am missing because if I Hold E I do not get that options menu for the lights. Also turning off and on doesn't do anything. All I can see is the emissive light nothing more. Doesn't light up an area or can be turned off or on.
I'm not 100% sure if that is xml related or unity related. I'll explain how to add them a little better in unity to make sure you got that part right. In unity drag the traffic light prefab into your scene hierarchy. Now right click your prefab in the scene hierarchy and select "light" and chose the light type you want, Point or Spot are the best choices. This will create a new light paired to your prefab. Now select your newly created light and in the #scene window you can position it to where you want the light to come from, not inside the geometry though. When you have the light looking the way you want you can drag your prefab from the scene hierarchy into the project window. Then export it to .unity3d the way you did before. That should be it. Your light should show up in game. Although I've not yet made a static light the way you are, I've used this method for moving lights and it worked very well, I can't see a reason why it wouldn't work for you. So if you did do as I suggested above then the problem may be on the xml side of things :-)

 
You have a good traffic light model? Send me the .unitypackage, I'll do the green to yellow to red animations, sounds fun, and is in my wheelhouse.

 
You have a good traffic light model? Send me the .unitypackage, I'll do the green to yellow to red animations, sounds fun, and is in my wheelhouse.
Going to send the link to you on Discord along with Khelldon

 
Oh you get this working (hopefully with red yellow green animations) i know 2 people whom are very eager for these to use in their prefabs lol.....

 
Oh you get this working (hopefully with red yellow green animations) i know 2 people whom are very eager for these to use in their prefabs lol.....
Yessir - We are trying to figure it out. Between GuppyCur, Khelldon and myself. We can get the animations down, but trying to figure out what actually triggers or fires the Turn On/Off seems to be the challenge. Making them Static On is no problem that parts easy. Making them interact gotta figure out either a work around or a way to trick them.

We thought using the same methods as the Doors would work because the doors use a OpenTrigger and was thinking that would work for lights but seems they have a different trigger name just not sure what it would be called.

 
I sent you the traffic light .unitypackage, complete with animation. What are you looking to do with it? Turn it on somehow?

If you want to just hit "E" to turn it on, that's easy. If you want it to only turn on via electricity, that's gonna be a problem. =)

[video=youtube_share;poOL1_fuinA]

 
I sent you the traffic light .unitypackage, complete with animation. What are you looking to do with it? Turn it on somehow?
If you want to just hit "E" to turn it on, that's easy. If you want it to only turn on via electricity, that's gonna be a problem. =)

[video=youtube_share;poOL1_fuinA]

Nice Guppy! I don't see the lights though, only the emission. Are there light entities in there?

 
I sent you the traffic light .unitypackage, complete with animation. What are you looking to do with it? Turn it on somehow?
If you want to just hit "E" to turn it on, that's easy. If you want it to only turn on via electricity, that's gonna be a problem. =)

[video=youtube_share;poOL1_fuinA]

Just want to be able to Hit E to turn them on or off.

 
Back
Top