IMPORTANT: To remove the black background from the laser in newer versions of unity, in the last node you have to draw a line to "Base Color" and also to "Alpha".
@@razlubinsky take the Out(4) of the last multiply node at 3:44 to Base Color (3) and also to the Alpha(1) of the Fragment node at the end of the process The Fragment Node isn’t in the video cuz it is a previous version
Quick question friend I did that But now my laser beam can just not be green or blue anymore as soon as I do that, do you know why ? Also the little icon that shows how the shader will look in the project doesn’t look like in the video There is a cut in the middle
@@himeyuxi7125 There is actually a better way than connecting the node to alpha. This will also let you color the laser however you'd like, blue and green included. Go into the graph and go to the master settings. You should see something called blending mode. Set this to additive. That should fix your issue.
Solving the problem of crazy glow in a 3d scene in play mode: If you get a full-screen glow in the play mode, and everything is fine in the scene view, then try adding a Clamp node (min 0, max 1) after the final gradient node (between Power and Multiply). A wonderful lesson, thank you! Still relevant in 2024! I'm using this in a 3d scene in Unity 2022.3.14f1.
Great video! Just want to say that if u are having problems with the bloom post processing effect not affecting the laser in game view, just make sure you have the HDR set to true under your Quality section int the URP asset that you created. Lost 1h trying to debug every aspect of the shader and other things, hope this helps someone with the same problem...
Un the video he seems to use a profile that he probably made before I just have an empty slot there so it has no effect but there is nothing to change Is it due to a newer version of Unity or am I supposed to do something before ?
Quick Tip - not sure if it is mentioned in the video but if you want to be able to change the length of the laser without it looking like its getting stretched/squished (along the length of the laser), then change the "Texture Mode" to "Tile" on your Line Renderer
if anyone is struggling with the bloom effect, try changing the intensity value of the HDR value of your line renderer's material, and if bloom isnt applied in the game view make sure that your camera has "Post Processing" checked
Un the video he seems to use a profile that he probably made before I just have an empty slot there so it has no effect but there is nothing to change Is it due to a newer version of Unity or am I supposed to do something before ?
The channel has amazing videos, but this one is probably my favorite. It shows very simple usage of shadergraph, but very effective with an amazing results. The only one thing I would've changed is the laser having a static length of X instead of the mouse position, which should be a little more simply to write in code and more realistic for a game. But again, amazing video
@@GabrielAguiarProd Yeah. Keep up the great work! I will buy your Udemy course soon. I feel like your course can finally teach me how to be good and thoughtful with the VFX! Do you have any 2D videos in your Udemy course or is it exclusively for 3D (which is also fine)?
Hi there, Thanks for tutorial but I get this error: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them and material/shader is not working ( the line dissapears)
great video just wanna mention that this works step by step in unity 2020 but there are some problems in unity 2021 if you wanna follow this video step by step it's better to use unity 2020
Hello, I am using forward renderer instead of 2d renderer. Everything is working fine but whenever i am firing laser whole game screen becoming very bright. But in scene screen everything is looking fine. Other users are also having similar problem. Please help. Thanks
@@GabrielAguiarProd Thanks for the reply. I solved this problem by using clamp in my Bloom. But I have a different problem, please help me to solve this problem. I am getting dotted lines in both sides of the laser. ruclips.net/video/Mb5ifJL74pY/видео.html Please tell me how to fix this. Thanks
Hey! Awesome, thanks for sharing! Everything went ok, but I want to know how I can remove the black background from the laser line renderer? In the parts of my level where the light is brighter the black background is very noticeable.
This is kinda old now so not sure if you figured it out but I had the same problem in a newer version of unity. In the last node you have to draw a line to "Base Color" and also to "Alpha". I think alpha used to be lumped in with all the colors.
@@pidlyi did so and it worked But I have an issue now bc when I set the color to green or blue it just disappear But no problem with purple yellow or red I have no idea why this is occurring
How did you manage to make the bloom only affect the laser beam? I created the object successfully but it makes everything on the scene to emit light. Thanks for the video!
Well the Bloom here is not affecting only the Laser. It might seem like it, but it's just a global volume with a profile that has bloom :) But I believe you can make volumes only work on for a specific layer perhaps, which means the VFX would be on one layer and volume would only affect that layer.
@@GabrielAguiarProd Thanks for the fast reply! It was my fault, I didn't realize but the configuration i set up for the URP was wrong. 😅 Yeah, now i've been able to make the bloom or other effects only apply on specific layers. Thanks a lot for your help and you video.
Why does other parts of your scene not light up when you are using the bloom? Your bloom value is extremely high. How is the gun and scene not lighting up?
@@nothingatall6703 not really. I paid the Patreon and never got a response. However, I realized that you need a light multiplier, and your sprites have to be lit with a darker color (set them to gray-black) in order for this multiplier to affect only the ray itself. I forgot the name of the multiplier, but he adds it on this tutorial
Hello, I've encounter a problem on the bloom effet. In deed, the bloom himself work, but when I press play, the bloom is going crazy and makes lot of flash if my character move, or if I try to manually move or rotate the laser. However, it is going back to normal when my character stops himself. Does anyone have a solution for this weird bug?
How would i go about having this detect if it collides with a gameobject with a certain tag? Currently, the raycast is going through all walls and not being blocked
What to do if i want only the direction of line renderer to be in the direction of mouse but length of line renderer will be predifined and only if raycast hits the end position becomes hit position?
Sugestão de pauta: poderia fazer um shader 3d de deserto, estilo journey? Onde ficam as pegadas e as areais se movem com o vento. Fã do seu trabalho! :D
How to do with static movement and without the mouse? Please make one for this I really need it for my game and I can't find a better one, I'm new to programming.
For some reason when I add that last multiply node to the shader graph and connect to Color/SpritLitMaster the line doesn't show up anymore and the Main preview goes grey in SG. If I don't add that last Multiple node and directly connect the power node to the color it shows up. Any ideas?
I have the laser working great, but I cannot for the life of me figure out why I cannot get the VFX to show up. I did not see you drag the parent VFX objects into script locations, does FillLists populate those?
Yes drag and drop 'StartVFX' and 'EndVFX' to their respective variables in the 'Laser' script. 'FillLists' will add the particle systems parented to those gameobjects ('StartVFX' and 'EndVFX') to the 'particles' list. Then 'EnableLaser 'and 'DisableLaser' functions will play or stop all the particle systems in the 'particles' list.
using System.Collections; using System.Collections.Generic; using UnityEngine; using static UnityEngine.ParticleSystem; public class LaserTut : MonoBehaviour { public Camera cam; public LineRenderer lineRenderer; public Transform firePoint; public GameObject startVFX; public GameObject endVFX; private Quaternion rotation; private List particleSystems; void Start() { FillLists(); DisableLaser(); } void Update() { if (Input.GetButtonDown("Fire1")) { EnableLaser(); } if (Input.GetButton("Fire1")) { UpdateLaser(); } if (Input.GetButtonUp("Fire1")) { DisableLaser(); } RotateToMouse(); } void EnableLaser() { lineRenderer.enabled = true; // Add additional logic if needed, e.g., start VFX for (int i = 0; i < particleSystems.Count; i++) particleSystems[i].Play(); } void UpdateLaser() { var mousePos = (Vector2)cam.ScreenToWorldPoint(Input.mousePosition); lineRenderer.SetPosition(0, firePoint.position); lineRenderer.SetPosition(1, mousePos); Vector2 direction = mousePos - (Vector2)transform.position; RaycastHit2D hit = Physics2D.Raycast((Vector2)transform.position, direction.normalized, direction.magnitude); if (hit) { lineRenderer.SetPosition(1, hit.point); // Add logic for endVFX or other actions on hit } } void DisableLaser() { lineRenderer.enabled = false; // Add additional logic if needed, e.g., stop VFX for (int i = 0; i < particleSystems.Count; i++) particleSystems[i].Stop(); } void RotateToMouse() { Vector2 direction = cam.ScreenToWorldPoint(Input.mousePosition) - transform.position; float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg; rotation.eulerAngles = new Vector3(0, 0, angle); transform.rotation = rotation; } void FillLists() { for (int i = 0; i < startVFX.transform.childCount; i++) { var ps = startVFX.transform.GetChild(i).GetComponent(); if (ps != null) particleSystems.Add(ps); } for (int i = 0; i < endVFX.transform.childCount; i++) { var ps = endVFX.transform.GetChild(i).GetComponent(); if (ps != null) particleSystems.Add(ps); } } /* void FillLists() *//* { // Example method to populate particleSystems or other lists if needed particleSystems = new List(); // Add your particle systems here }*/ }
Hi, when I add the LineRenderer, the line is completely black and does not change when I change the color settings. I can't figure out what I'm missing
I have a warning which says "MaterialPropertyBlock is used to modify these values ". Is this the reason that I can not make the laser thicker and if it is, can u please help me
Thank you for it but I have some issue with the tutorial Firstly some stuffs has changed in Unity with time so I had to guess how to do some stuffs that were not like in the video But as someone said in the comment I linked the last multiply to the Alpha to remove the black background But it also has the effect to prevent me from making the color to green or blue Like I can make the laser red or yellow But not green or blue It makes it fully disappear Also the shader icon the my project doesn’t look the same as yours Mine seems cut in the middle but I can’t figure why I hope someone here can help me 😅 Hnd
my laser is working without any background but if I put a background image/sprite the laser disappears and I even checked the layers correctly and laser is in foreground. Any HELP?
Hey brother, incase you/Anyoneelse hasnt figured it out yet, package manager -> install post processing ->in your global volume add a new profile if you dont already have one ->Go to that profile (by clicking on it) and click "Add Override" ->Postprocessing ( you just installed it ) -> bloom etc
I can make the material and apply it to the line renderer, but all it does is make a line with black edges. Did I miss something in creating the materials?
Hello, Congratulations for another great video. I am a beginner in unity development, I followed his example, but the black part of the shader was not transparent. Can you help me?
hey sir my laser thickness is not increased in line renderer what can i do?? i did all the things.....as per you...the laser intensity increased but not laser thickness since unity 2021 has no vector 1 i used float instead...can yu please help me out sir?
@@nothingatall6703 Adjust the width in the line renderer. You should see a red line. The biggest number on the red line will be 0.10. Click that and type in a larger number.
Cool tutorial, but my laser flickers randomly every now and then (There are very bright circles at some random point on the laser), anyone knows a fix?
i was having the same problem, only solution i found is, clamp the power node in shader graph between any 2 values. i have clamped between 7 & 8. Smaller the range the less it will flicker so keep the range small so flickring will become unnoticable.
At 5:51, when I increase the line width, the glow flickers from small to large and back to small really quickly. This also happens when I adjust the size of the Game Screen. It doesn't appear to have happened to you. Do you know why this happens? Thank you! Great tutorial btw!
@@SierraDyne_ You need to change your camera setting to ortographic. If you want to keep it perspective, you need to change mouse Input code in your script.
Hello. Thank you for the tutorial but it's not working for me, and i don't understand why. As you can see here imgur.com/a/Sp4O271 my shader is transparent at the end when i connect the last node to "Color". Can you help me please ? thanks
Not sure but have you tried to see if it outputs something with Debug.Log() every time you are checking if it has collided? Or maybe it colliding with your "character" before colliding with anything in the scene?
anyone have a script for this to automate this laser via a timer (trying to have an enemy AI fire the laser instead of the player). Any help would be greatly appreciated!
@@GabrielAguiarProd thanks! I considered that - my real question is where in the Updateloop would I implement the EnableLaser(), DisableLaser(), and UpdateLaser() functions, since I will not be using the getkey inputs to trigger the laser?
Shame you only used mouse input not everyone uses a mouse there is such a thing as a gamepad & why not use the new input system if using 2020.1 But 99% of youtubers forget or ignore us gamepad users.
It's in the description. Here: www.patreon.com/posts/unity-2d-laser-39800075 or in gap site: www.gabrielaguiarprod.com/product-page/unity-2d-lasers-project
@@GabrielAguiarProd Oh sorry I didn't know it costed money- I might get it in the future but when I use the URP, my bloom on my camera turns off and the 3d models in my 2d game turn pink
Pew! Pew! Who doesn't love lasers!!!
Hey check out the game working in, that would be awesome: store.steampowered.com/app/1763860/Rabbits_Tale/
IMPORTANT: To remove the black background from the laser in newer versions of unity, in the last node you have to draw a line to "Base Color" and also to "Alpha".
how
@@razlubinsky take the Out(4) of the last multiply node at 3:44 to Base Color (3) and also to the Alpha(1) of the Fragment node at the end of the process
The Fragment Node isn’t in the video cuz it is a previous version
Quick question friend
I did that
But now my laser beam can just not be green or blue anymore as soon as I do that, do you know why ?
Also the little icon that shows how the shader will look in the project doesn’t look like in the video
There is a cut in the middle
Thanks Mate U saved My time❤
@@himeyuxi7125 There is actually a better way than connecting the node to alpha. This will also let you color the laser however you'd like, blue and green included. Go into the graph and go to the master settings. You should see something called blending mode. Set this to additive. That should fix your issue.
Solving the problem of crazy glow in a 3d scene in play mode:
If you get a full-screen glow in the play mode, and everything is fine in the scene view, then try adding a Clamp node (min 0, max 1) after the final gradient node (between Power and Multiply).
A wonderful lesson, thank you! Still relevant in 2024!
I'm using this in a 3d scene in Unity 2022.3.14f1.
Unversal Pipeline Render, Custom Shaders, Mouse Controls, Particles - all in 20 minutes! Gabriel, you are awesome! Thanks a lot!
Great video! Just want to say that if u are having problems with the bloom post processing effect not affecting the laser in game view, just make sure you have the HDR set to true under your Quality section int the URP asset that you created. Lost 1h trying to debug every aspect of the shader and other things, hope this helps someone with the same problem...
Thanks for the tip!
Un the video he seems to use a profile that he probably made before
I just have an empty slot there so it has no effect but there is nothing to change
Is it due to a newer version of Unity or am I supposed to do something before ?
Quick Tip - not sure if it is mentioned in the video but if you want to be able to change the length of the laser without it looking like its getting stretched/squished (along the length of the laser), then change the "Texture Mode" to "Tile" on your Line Renderer
if anyone is struggling with the bloom effect, try changing the intensity value of the HDR value of your line renderer's material, and if bloom isnt applied in the game view make sure that your camera has "Post Processing" checked
Awesome tip, thanks for sharing with the community! 👍
Un the video he seems to use a profile that he probably made before
I just have an empty slot there so it has no effect but there is nothing to change
Is it due to a newer version of Unity or am I supposed to do something before ?
The channel has amazing videos, but this one is probably my favorite. It shows very simple usage of shadergraph, but very effective with an amazing results. The only one thing I would've changed is the laser having a static length of X instead of the mouse position, which should be a little more simply to write in code and more realistic for a game. But again, amazing video
Glad you enjoy it!
@@GabrielAguiarProd Yeah. Keep up the great work! I will buy your Udemy course soon. I feel like your course can finally teach me how to be good and thoughtful with the VFX! Do you have any 2D videos in your Udemy course or is it exclusively for 3D (which is also fine)?
Mostly 3D, but there's a few 2D specific ruclips.net/p/PLpPd_BKEUoYj9LEKgYeemilQLwqrJJ_Mf
Another great tutorial by Gabriel Aguiar!
Doesn't matter when you read this.
Thanks!
Thank you so much! I really do appreciate how you explain everything you're doing! (I finally get the raycasting for example)
Fantastic!
Nice Tutorial Gabriel! Thank you.
My pleasure!
Learned so much from this, thanks!
Thanks for this, had a slightly different use-case but it gave me what I needed to figure the rest out :)
Great to hear!
Hi there, Thanks for tutorial but I get this error: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
and material/shader is not working ( the line dissapears)
I think it's because the color isn't set to hdr. I got the same error and it disappeared once i did that.
great video just wanna mention that this works step by step in unity 2020 but there are some problems in unity 2021 if you wanna follow this video step by step it's better to use unity 2020
Yes. Do you know the solution?
If you try this in a 3d scene, make sure to clamp the powered gradient between 0 and 1, or you might get some CRAZY bloom
Hello,
What is powered gradient? Power node Inside shader graph? Which power node?
Hey man, this was great. Thanks :) Too much fantastic information in 20 minutes
My pleasure! Glad you liked it :)
Great tutorial!
Wow! 2D Renderer! At last! :)))) BI-I-IG Thanks! :)
You're welcome! I've got a few more on my channel
Amazing! Thanks
Can you use a 2d renderer in a 3d game? My game's in 3d, top down, but I need a laser like this still. Any suggestions?
Perhaps try combining it with this one: ruclips.net/video/_SaBXY-Ejqo/видео.html
This is just what I needed, thank you!!
Ref should be "_MainTex" not "MainTex_"
Amazing. Thanks
This is excellent! Now I just need to figure out how to use this in Space Chef 😀 i think some kind of portable mining laser..
That would be cool!
Hello,
I am using forward renderer instead of 2d renderer. Everything is working fine but whenever i am firing laser whole game screen becoming very bright. But in scene screen everything is looking fine. Other users are also having similar problem. Please help.
Thanks
I don't know why this is happening. But have you tried to decrease the intensity of the laser color? Mayb also decrease the Bloom (if you have any)?
@@GabrielAguiarProd Thanks for the reply. I solved this problem by using clamp in my Bloom. But I have a different problem, please help me to solve this problem.
I am getting dotted lines in both sides of the laser.
ruclips.net/video/Mb5ifJL74pY/видео.html
Please tell me how to fix this.
Thanks
Amazing video, thank you so much!💪
No problem 👍
Hey! Awesome, thanks for sharing! Everything went ok, but I want to know how I can remove the black background from the laser line renderer? In the parts of my level where the light is brighter the black background is very noticeable.
This is kinda old now so not sure if you figured it out but I had the same problem in a newer version of unity. In the last node you have to draw a line to "Base Color" and also to "Alpha". I think alpha used to be lumped in with all the colors.
@@pidly Thanks so much!
@@pidlyi did so and it worked
But I have an issue now bc when I set the color to green or blue it just disappear
But no problem with purple yellow or red
I have no idea why this is occurring
U r awesome 😀👍
Awesome video
Thanks!
Awesome
How did you manage to make the bloom only affect the laser beam?
I created the object successfully but it makes everything on the scene to emit light.
Thanks for the video!
Well the Bloom here is not affecting only the Laser. It might seem like it, but it's just a global volume with a profile that has bloom :)
But I believe you can make volumes only work on for a specific layer perhaps, which means the VFX would be on one layer and volume would only affect that layer.
@@GabrielAguiarProd Thanks for the fast reply!
It was my fault, I didn't realize but the configuration i set up for the URP was wrong. 😅
Yeah, now i've been able to make the bloom or other effects only apply on specific layers.
Thanks a lot for your help and you video.
Why does other parts of your scene not light up when you are using the bloom? Your bloom value is extremely high. How is the gun and scene not lighting up?
Maybe u set the Threshold value to < 0.9, then everything else lights up as well
Whatever I do, my laser doesn't glow or increase its thickness with the value, it gets stuck in a rectangle and it looks as it was a stretched sprite
Did u find a solution about the thickness, I can not increase too
@@nothingatall6703 not really. I paid the Patreon and never got a response. However, I realized that you need a light multiplier, and your sprites have to be lit with a darker color (set them to gray-black) in order for this multiplier to affect only the ray itself. I forgot the name of the multiplier, but he adds it on this tutorial
Can you make electricity using this method?
great video! But, How to make the rainbow Laser when shot, the rainbow color moving to target repeatedly?
Hello, I've encounter a problem on the bloom effet.
In deed, the bloom himself work, but when I press play, the bloom is going crazy and makes lot of flash if my character move, or if I try to manually move or rotate the laser.
However, it is going back to normal when my character stops himself. Does anyone have a solution for this weird bug?
Have you found a soultion to this by any chance? Experiencing the same issue :c
This comment is super old but just go to your particle material and change the intensity on the HDR color space
How would i go about having this detect if it collides with a gameobject with a certain tag? Currently, the raycast is going through all walls and not being blocked
The position of the laser seems to only update every 0.3 seconds or so rather than every frame, any idea why?
What to do if i want only the direction of line renderer to be in the direction of mouse but length of line renderer will be predifined and only if raycast hits the end position becomes hit position?
Will it work on mobiles without much processing
Sugestão de pauta: poderia fazer um shader 3d de deserto, estilo journey? Onde ficam as pegadas e as areais se movem com o vento. Fã do seu trabalho! :D
How to do with static movement and without the mouse? Please make one for this I really need it for my game and I can't find a better one, I'm new to programming.
I don't know how you make the laser look that blurred and brighten. I just get the texture to work.
Great video mine doesn't have unlit in universal render pipeline/particles what could it be forgotten?
How to disable global bloom for weapon and other things except the laser line?
you're the best
Great Stuff
how do i create this as a pixel art?
For some reason when I add that last multiply node to the shader graph and connect to Color/SpritLitMaster the line doesn't show up anymore and the Main preview goes grey in SG. If I don't add that last Multiple node and directly connect the power node to the color it shows up. Any ideas?
Please tell me why my line from line renderer is completely no smooth. Its look so bad
I have the laser working great, but I cannot for the life of me figure out why I cannot get the VFX to show up. I did not see you drag the parent VFX objects into script locations, does FillLists populate those?
Yes drag and drop 'StartVFX' and 'EndVFX' to their respective variables in the 'Laser' script. 'FillLists' will add the particle systems parented to those gameobjects ('StartVFX' and 'EndVFX') to the 'particles' list. Then 'EnableLaser 'and 'DisableLaser' functions will play or stop all the particle systems in the 'particles' list.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using static UnityEngine.ParticleSystem;
public class LaserTut : MonoBehaviour
{
public Camera cam;
public LineRenderer lineRenderer;
public Transform firePoint;
public GameObject startVFX;
public GameObject endVFX;
private Quaternion rotation;
private List particleSystems;
void Start()
{
FillLists();
DisableLaser();
}
void Update()
{
if (Input.GetButtonDown("Fire1"))
{
EnableLaser();
}
if (Input.GetButton("Fire1"))
{
UpdateLaser();
}
if (Input.GetButtonUp("Fire1"))
{
DisableLaser();
}
RotateToMouse();
}
void EnableLaser()
{
lineRenderer.enabled = true;
// Add additional logic if needed, e.g., start VFX
for (int i = 0; i < particleSystems.Count; i++)
particleSystems[i].Play();
}
void UpdateLaser()
{
var mousePos = (Vector2)cam.ScreenToWorldPoint(Input.mousePosition);
lineRenderer.SetPosition(0, firePoint.position);
lineRenderer.SetPosition(1, mousePos);
Vector2 direction = mousePos - (Vector2)transform.position;
RaycastHit2D hit = Physics2D.Raycast((Vector2)transform.position, direction.normalized, direction.magnitude);
if (hit)
{
lineRenderer.SetPosition(1, hit.point);
// Add logic for endVFX or other actions on hit
}
}
void DisableLaser()
{
lineRenderer.enabled = false;
// Add additional logic if needed, e.g., stop VFX
for (int i = 0; i < particleSystems.Count; i++)
particleSystems[i].Stop();
}
void RotateToMouse()
{
Vector2 direction = cam.ScreenToWorldPoint(Input.mousePosition) - transform.position;
float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
rotation.eulerAngles = new Vector3(0, 0, angle);
transform.rotation = rotation;
}
void FillLists()
{
for (int i = 0; i < startVFX.transform.childCount; i++)
{
var ps = startVFX.transform.GetChild(i).GetComponent();
if (ps != null)
particleSystems.Add(ps);
}
for (int i = 0; i < endVFX.transform.childCount; i++)
{
var ps = endVFX.transform.GetChild(i).GetComponent();
if (ps != null)
particleSystems.Add(ps);
}
}
/* void FillLists()
*//* {
// Example method to populate particleSystems or other lists if needed
particleSystems = new List();
// Add your particle systems here
}*/
}
You are my new favorite person.
Do you have a method of turning off the VFX? I don't know how to lol.
dawggg you saved me so much time!
Hi, when I add the LineRenderer, the line is completely black and does not change when I change the color settings. I can't figure out what I'm missing
have you added any lights to your scene? its a lit shader, so needs lighting
Yo, how (and could I) could I use this as some kind of attack for my platformer game?
I have a warning which says "MaterialPropertyBlock is used to modify these values ". Is this the reason that I can not make the laser thicker and if it is, can u please help me
Thank you for it but I have some issue with the tutorial
Firstly some stuffs has changed in Unity with time so I had to guess how to do some stuffs that were not like in the video
But as someone said in the comment I linked the last multiply to the Alpha to remove the black background
But it also has the effect to prevent me from making the color to green or blue
Like I can make the laser red or yellow
But not green or blue
It makes it fully disappear
Also the shader icon the my project doesn’t look the same as yours
Mine seems cut in the middle but I can’t figure why
I hope someone here can help me 😅
Hnd
Add Global Volume to your project. Google Unity: How To Add Bloom In URP
my laser is working without any background but if I put a background image/sprite the laser disappears and I even checked the layers correctly and laser is in foreground. Any HELP?
check if you have Universal Pipe Renderer assigned.
In my game the laser looks horrible, where i can get a tutorial for configure universal render pipeline?
Hi, I can’t get the glow effect. I’m using unity 2021. I don’t have the master sprite tool
same here, did you solved that?
when i created Global Volume, i can find bloom to add , help :((
Hey brother, incase you/Anyoneelse hasnt figured it out yet,
package manager -> install post processing
->in your global volume add a new profile if you dont already have one
->Go to that profile (by clicking on it) and click "Add Override"
->Postprocessing ( you just installed it ) -> bloom etc
@@meatyourhouseatnight omg , i'm newbie so i dont know about it . Thank to you , now i can create it. Tks a lots.
@@12a2-nguyenduy8 glad i could help. :')
@@meatyourhouseatnight you're great, can i connect with you , i'm still noob :(((
2 problems,
Problem1: SOLVED
problem2: endVFX is just a little to the right of the mouse and I cant seem to stop it.
does someone know the solution?
When I change the Index X under Positions, it creates a circle, not a line? I followed all your steps to the letter, what could be the issue?
I figured it out. had to change the default material to Sprite Lit Default
Do anyone knows how to reflect the laser????
my glow effect doesn't affect to the laser line, do you know why?
Try saving the shader asset, if you have not
How do i make a Beam like in 20:53 ? I just bought the Project but a cant find it.
Please look closely, I'm sure it's there. Check the prefabs folder, or maybe in the scene attached to another object (can't remember where).
Does this only work in URP? I already have a non URP project created.
Oh, also I sent you an email. Would you possibly be able to respond to that?
The thickness of the laser doesnt really change its size, can u please help
Increasing it doesn’t change much
But decreasing the value until it gets negative thickens it
I can make the material and apply it to the line renderer, but all it does is make a line with black edges. Did I miss something in creating the materials?
Try setting the shader blending mode to additive in Graph Inspector -> Universal -> Blending mode. Setting it to additive fixed it in my case
@@xuanthinhang7883 Yessir, that fixed it real easy, much obliged! ^_^ Now I have a proper laser
Hi thx for the video but my black part is not transparent
Make sure your texture doesn't have a black background.
@@GabrielAguiarProd What texture? It's just the UV map. How do you remove the black background?
why my linerenderer goes to the middle of the screen?
You need to uncheck "World Space" in your Line Renderer settings.
After I apply the material, I don't get any options to "play with". My Material is just white and nothing happens
Don't forget to save your shader. Press Save Asset in Shader Graph, top left corner.
Hello, Congratulations for another great video.
I am a beginner in unity development, I followed his example, but the black part of the shader was not transparent. Can you help me?
Maybe set the shader blend mode to Additive?
@@GabrielAguiarProd can you tell me how to do this. Thanks in advance.
I think in newer versions of Unity they break alpha out of the color so in the last node you have to make a line to color AND alpha.
At 4:36 am, when I try to adjust the parameter "LaserThickness", this glow does not occur, please help, thanks!
I have a Global Volume with Bloom, that's why It glows like that :)
@@GabrielAguiarProd Thank you, but it turns out I had to turn on the camera parameter "post-processing" to make everything work)
@@Ascadey Yeah sometimes I forget that part too :)
Not sure why but cant seem to get the same amount of glow as you're getting,
i think its after post process effects so its more glowy.
hey sir my laser thickness is not increased in line renderer what can i do?? i did all the things.....as per you...the laser intensity increased but not laser thickness since unity 2021 has no vector 1 i used float instead...can yu please help me out sir?
Did u find a solution , Im having the same problem
@@nothingatall6703 Adjust the width in the line renderer. You should see a red line. The biggest number on the red line will be 0.10. Click that and type in a larger number.
The particles are never played out.
Cool tutorial, but my laser flickers randomly every now and then (There are very bright circles at some random point on the laser), anyone knows a fix?
i was having the same problem, only solution i found is, clamp the power node in shader graph between any 2 values. i have clamped between 7 & 8. Smaller the range the less it will flicker so keep the range small so flickring will become unnoticable.
@@freestylerak6655 I fixed it by lowering the bloom "clamp" value to something reasonable.
At 5:51, when I increase the line width, the glow flickers from small to large and back to small really quickly. This also happens when I adjust the size of the Game Screen. It doesn't appear to have happened to you. Do you know why this happens? Thank you!
Great tutorial btw!
Bloom too high maybe? Dunno
@@GabrielAguiarProd I will try and lower the bloom. Maybe its a bug as well. Thank you!
download link?
I wrote exactly the same code, but my line goes to middle of screen? Whyy?
mine too
@@SierraDyne_ You need to change your camera setting to ortographic. If you want to keep it perspective, you need to change mouse Input code in your script.
@@botansahin thanks. Any idea as to why i cant aim the laser up without it going thin?
@@SierraDyne_ I dont know I didnt have this issue. İf you have bloom, it might be because of lights.
Botan Şahin hm, i have bloom except i dont think its that
want to add this but need to switch to URP ahhhhhhh
Hello. Thank you for the tutorial but it's not working for me, and i don't understand why. As you can see here imgur.com/a/Sp4O271 my shader is transparent at the end when i connect the last node to "Color". Can you help me please ? thanks
Increase the Alpha in the color.
what about some realistic effects? instead of these cartoony stuff?
There's a few on my channel that lean a bit more towards the realistic side of things. Enjoy.
@@GabrielAguiarProd thanks. i will check them.
it would be nice if u had released the project on github
why my raycasting not working
Not sure but have you tried to see if it outputs something with Debug.Log() every time you are checking if it has collided? Or maybe it colliding with your "character" before colliding with anything in the scene?
@@GabrielAguiarProd Thankyou. I used layermask to avoid other objects then it worked.
Thanks for the video but the background music is loud and annoying.
Thankfully it’s only in the beginning and in the end. It goes away after a while. Stay well, enjoy.
anyone have a script for this to automate this laser via a timer (trying to have an enemy AI fire the laser instead of the player). Any help would be greatly appreciated!
Use a Coroutine for example. Google it, they are quite easy to implement. Hope this helps.
@@GabrielAguiarProd thanks! I considered that - my real question is where in the Updateloop would I implement the EnableLaser(), DisableLaser(), and UpdateLaser() functions, since I will not be using the getkey inputs to trigger the laser?
nvm, you were right, the coroutine works great! thank you!
Yeaaah
this made Unity crash, my pc and visual studio, then all scripts invalid and permanent error when starting anything new on Unity Hub lol
at least tell which fricking template to open up first
At least don't skip the 0:40 part
Oh my gawd I am so stupid. Sorry for the rudeness. I am just frustrated I have been trying to learn this from morning. I am so sorry.
It's fine, no problem :)
Sometimes learning can be a frustrating process. What matters is to never give up.
Good luck and stay well.
@@GabrielAguiarProd thanks so much. Same to u and again sorry.
Shame you only used mouse input not everyone uses a mouse there is such a thing as a gamepad & why not use the new input system if using 2020.1
But 99% of youtubers forget or ignore us gamepad users.
download link?
It's in the description. Here: www.patreon.com/posts/unity-2d-laser-39800075 or in gap site: www.gabrielaguiarprod.com/product-page/unity-2d-lasers-project
@@GabrielAguiarProd Oh sorry I didn't know it costed money- I might get it in the future but when I use the URP, my bloom on my camera turns off and the 3d models in my 2d game turn pink