I have to say I really enjoy the concept tidbits you throw in all over your videos. I'm a Java dev by trade but am just starting game dev as a hobby. The "concept space" stuff is really helpful for me to see what is possible.
Best video for that topic! Thank you very much. This a well made video and explanation for this effet and the code is as short and smart as it needs to be!
Thanks Dani a great tutorial, been looking at other parallax scrolling tutorials and yours explains it much better than the rest. I now have a decent background moving many thanks. onto the character controller now.
I don't know what to say! Thank you so much for making this series, you are a genius good sir 🥳😃❤! Also the amount of videos you have been putting out lately, make sure you don't forget to sleep haha😎👍
Haha thanks Ludvig 😊 yeah I finally did a full commitment by shifting my mindset more towards teaching something I was passionate about. 🙂 I was always kinda scared to “leave behind” web dev tutorials, since I back then continued to make them anyways because my subscribers asked for it, which is also why I got burned out and needed a loooong break from tutorials hehe. 😅 But now I’m over it again, and ready to make tutorials! 😁 This time by sticking to what I WANNA MAKE hehe (game dev).
I watched around 10 videos on this but only you explained it better with easy-to-follow working solution. I needed the same system for a vertical game, I tweaked your code easily because you explained it well. Thak you very much!
Small help: 1: first place the copied layers, then place them. 2. placing them seamless, is easier if you use 'v' and take the lower corner and snap them to the other one.
I gotta say, Thanks a ton for these videos! I really appreciate you spending the time to sit down and help explain these things out in a simple to understand way. It is really getting me back into my game design work again after a long break. (I'm more of an artist/musician than a programmer, so I need really need the explanations) So again, Thanks a ton! I hope you keep it up. I would like to learn a lot more from you! ^_^ I ended up copying/changing this for both Y and X positions, and making to i can control each separately. I'm not sure if what i ended up creating is any good in terms of clean code. but it looks good when the camera scrolls up/down. BTW, the backgrounds seem to be a little bit jerky when the parallax effect happens (for both x or y position), is there a way to mack it smoother?.
Thanks for the video! Everything is working perfectly as it should be, but background layers movement is visible in-game (I mean that background layers suddenly snaps forward). Any help?
hey hello, sorry for asking about such an old video but i couldn't find the video of how to create the profile page after the register-login php tutorial, is there a reason, maybe there is already a video idk.
I never got around to that video, since I got burned out making tutorials right after the login video. I have only recently (about a month ago) gotten back into making tutorials again, and currently my main focus is on game dev videos. 🙂
@@Dani_Krossing ooh its okay man, hope you are good, Any recommendation of a video or course on just that topic from users, sessions, etc., and I've seen that some of your old ones can be useful
So, the parallax effect is working for me, however, the script is adding an offset in the X off set based on the float 'parallaxEffect'. Is there anyway to have my background keep their original starting position in the scene?
Awesome video! Its a big help. I do have one issue. I made different backgrounds for each layer for variety and they are stacking on top of each other when they spawn in. How do I fix that from happening? Any help is appreciated.
im a beginner and i dont understand why we cannot just drag a big image far behind with the z axe and the going more and more in front with a smaller image. it does the same effect or am i wrong?
Try unselecting everything, so that the Inspector window is empty. And then play your game then in Unity. For some reason Unity doesn’t have good performance when there is something selected.
IDK if you fixed this, but the issue for me was that I accidently had: else if (temp > startPosition - length) when it SHOULD be: else if (temp < startPosition - length)
few years ago I am pretty sure I did parallax background in Godot in 5 minutes just dropped pictures on parallax layer node or something like that and that it. why it is such problem in Unity.
Looping the offset wouldn't really do anything, but I assume you meant doing it in the Update. I haven't tried doing it that way, but if you have tried it and it works, then I'm sure that is another solution. :)
I'm using a confiner for cinemachine and when it reaches the end of that confiner in the x-axis the parallax effect still goes when the player moves even though the camera itself isn't moving. Is there a way to stop that effect from happening?
So, is there any way for you to explain the float temp variable? Like in even simpler terms. I understand what the code is there for when it gets compared to the startPos + length, but I don't understand why it's 1 - parallaxEffect. I know you said it gets us the position of the object at the given point in time....but I guess I don't understand how that is. I think this is more of me not getting the math behind it? I've been wrapping my head around this for a while now but it's just not clicking. I mean, the code works fine in my project, but I want to make sure that I understand every line.
The way I run my channel and it’s content, is that my lesson material is made available on Patreon or UA-cam memberships. 🙂 And because many of my viewers are already members and were the ones who originally suggested and supported me doing it this way, I will continue to do so. 🙂 However… Although my lesson material policy is to make it available as a membership perk, what I CAN do, is to make the next tutorial a video that shows how to draw it yourself step by step 🙂
I have to say I really enjoy the concept tidbits you throw in all over your videos. I'm a Java dev by trade but am just starting game dev as a hobby. The "concept space" stuff is really helpful for me to see what is possible.
Best parallax tutorial i've ever seen! Thank you mate.
Best video for that topic! Thank you very much. This a well made video and explanation for this effet and the code is as short and smart as it needs to be!
Thanks Dani a great tutorial, been looking at other parallax scrolling tutorials and yours explains it much better than the rest. I now have a decent background moving many thanks. onto the character controller now.
I don't know what to say! Thank you so much for making this series, you are a genius good sir 🥳😃❤! Also the amount of videos you have been putting out lately, make sure you don't forget to sleep haha😎👍
Haha thanks Ludvig 😊 yeah I finally did a full commitment by shifting my mindset more towards teaching something I was passionate about. 🙂
I was always kinda scared to “leave behind” web dev tutorials, since I back then continued to make them anyways because my subscribers asked for it, which is also why I got burned out and needed a loooong break from tutorials hehe. 😅
But now I’m over it again, and ready to make tutorials! 😁 This time by sticking to what I WANNA MAKE hehe (game dev).
Bro you are awesome with explaining ! ! !
I watched around 10 videos on this but only you explained it better with easy-to-follow working solution. I needed the same system for a vertical game, I tweaked your code easily because you explained it well. Thak you very much!
Thanks for the informative lesson! Very helpful and easy to understand!
Small help: 1: first place the copied layers, then place them. 2. placing them seamless, is easier if you use 'v' and take the lower corner and snap them to the other one.
You're a legend!
Glad I found you, keep inspiring dude!
You, sir, are a life saver!
The parallax movement gets really choppy at higher speeds, how can I fix that?
You deserve a subscriber button shoot Nice video
I gotta say, Thanks a ton for these videos!
I really appreciate you spending the time to sit down and help explain these things out in a simple to understand way.
It is really getting me back into my game design work again after a long break. (I'm more of an artist/musician than a programmer, so I need really need the explanations)
So again, Thanks a ton! I hope you keep it up. I would like to learn a lot more from you! ^_^
I ended up copying/changing this for both Y and X positions, and making to i can control each separately.
I'm not sure if what i ended up creating is any good in terms of clean code. but it looks good when the camera scrolls up/down.
BTW, the backgrounds seem to be a little bit jerky when the parallax effect happens (for both x or y position), is there a way to mack it smoother?.
hey, I just don't get why we did the 1 - paralleseffect ???
Doesn't cinemachine just control the main camera anyways? You should be able to use the main cam in the code even though cinemachine is being used.
can you do a parallax effect without the camera moving?
I wonder is there a way to use perspective camera mode without having to scale the background up or making really huge assets?
I tried following this but when i go to the left they disappear one by one
ever any fix for this??? 🤔
Thanks for the video!
Everything is working perfectly as it should be, but background layers movement is visible in-game (I mean that background layers suddenly snaps forward). Any help?
hey, sorry for commenting on this old video but why is it jiterring? i wrote the same exact lines but it jitters?
hey hello, sorry for asking about such an old video but i couldn't find the video of how to create the profile page after the register-login php tutorial, is there a reason, maybe there is already a video idk.
I never got around to that video, since I got burned out making tutorials right after the login video. I have only recently (about a month ago) gotten back into making tutorials again, and currently my main focus is on game dev videos. 🙂
@@Dani_Krossing ooh its okay man, hope you are good, Any recommendation of a video or course on just that topic from users, sessions, etc., and I've seen that some of your old ones can be useful
what if my bg is not parallax and just static. but i want to tile it horizontally. how would my code look then? Please help me.
My Player can jump, and when he does all the layers go up with him, how can i stop this?
So, the parallax effect is working for me, however, the script is adding an offset in the X off set based on the float 'parallaxEffect'. Is there anyway to have my background keep their original starting position in the scene?
Awesome video! Its a big help. I do have one issue. I made different backgrounds for each layer for variety and they are stacking on top of each other when they spawn in. How do I fix that from happening? Any help is appreciated.
im a beginner and i dont understand why we cannot just drag a big image far behind with the z axe and the going more and more in front with a smaller image.
it does the same effect or am i wrong?
2D scales differently than 3D, so it wouldn't get smaller :) besides, you would need to make a HUGE image if you did it that way too.
does anyone know why the background does not move smoothly but has a flickering effect? I followed the tutorial step by step but I have this problem
Try unselecting everything, so that the Inspector window is empty. And then play your game then in Unity.
For some reason Unity doesn’t have good performance when there is something selected.
I have the same problem. Whem im moving fast everything becomes dobble. Also if i "build and run" the game
I fixed it :) Try to change the settings of the Camera. Update method to "Fixed update" & blend update methode also to "Fixed update"
IDK if you fixed this, but the issue for me was that I accidently had:
else if (temp > startPosition - length)
when it SHOULD be:
else if (temp < startPosition - length)
@@TechGuyDane Dude, you legend. I had the same problem and tried eVeRyThInG and THIS was the problem. Thank you.
few years ago I am pretty sure I did parallax background in Godot in 5 minutes just dropped pictures on parallax layer node or something like that and that it. why it is such problem in Unity.
why not just loop the offset texture of background material?
Looping the offset wouldn't really do anything, but I assume you meant doing it in the Update. I haven't tried doing it that way, but if you have tried it and it works, then I'm sure that is another solution. :)
Sorry I'm newbie with coding, so what if we don't want on cam but still parallax bg for 2d game ?
There are prebuilt scripts you can use
I'm using a confiner for cinemachine and when it reaches the end of that confiner in the x-axis the parallax effect still goes when the player moves even though the camera itself isn't moving. Is there a way to stop that effect from happening?
So, is there any way for you to explain the float temp variable? Like in even simpler terms. I understand what the code is there for when it gets compared to the startPos + length, but I don't understand why it's 1 - parallaxEffect. I know you said it gets us the position of the object at the given point in time....but I guess I don't understand how that is. I think this is more of me not getting the math behind it? I've been wrapping my head around this for a while now but it's just not clicking. I mean, the code works fine in my project, but I want to make sure that I understand every line.
Please give free video assets. Your style of explaining is great. Keep on Bro
The way I run my channel and it’s content, is that my lesson material is made available on Patreon or UA-cam memberships. 🙂 And because many of my viewers are already members and were the ones who originally suggested and supported me doing it this way, I will continue to do so. 🙂
However…
Although my lesson material policy is to make it available as a membership perk, what I CAN do, is to make the next tutorial a video that shows how to draw it yourself step by step 🙂
@@Dani_Krossing yes, please make videos on asset creation.
قناتك عباره عن شي احبه
Jeg går ud fra at du skriver noget positivt 😉
@@Dani_Krossing
Jeg fortalte dig, at jeg elsker dit indhold 😃😍
DANI WE NEED YOU.... LARAVEL IS HARD FOR US TO UNDERSTAND
I have never learned Laravel :) My main focus back 6 years ago when I worked as a multimedia designer, was on front-end dev.
Thanks man...
Is thies code right ?
public class parralalexi : MonoBehaviour
{
private float Length;
private float startPos;
private GameObject cam;
[SerializeField]private float parallexEffect;
// Start is called before the first frame update
void Start()
{
cam = GameObject.Find("MainCamera");
startPos = transform.position.x;
length = gameObject.GetComponent().bounds.size.x;
}
// Update is called once per frame
void Update()
{
float temp = (cam.transform.position.x * (1-parallexEffect));
float distance = (cam.transform.position.x * parallexEffect);
transform.position = new Vector3(startPos + distance, transform.position.y, transform.position.z);
if(temp > startPos + length)
{
startPos += length;
}
else(temp < startPos - length)
{
startPos -= length;
}
}
}
Am i the only one who thinks he looks like elon musk? lol
numbertwoguide
Er du dansker eller hvad?
Jeg er i hvertfald ikke en “hvad” 😛
Thank you so much ur wonderful
private float startPos;
private float Lenght;
private GameObject cam;
[SerializeField] private float parallaxEffect;
private void Start()
{
cam = GameObject.Find("Main Camera");
startPos = transform.position.x;
Lenght = gameObject.GetComponent().bounds.size.x;
}
private void Update()
{
float temporary = (cam.transform.position.x * (1- parallaxEffect));
float distance = (cam.transform.position.x * parallaxEffect);
transform.position = new Vector3(startPos + distance, transform.position.y, transform.position.z);
if(temporary > startPos + Lenght)
{
startPos += Lenght;
}
else if(temporary < startPos - Lenght)
{
startPos -= Lenght;
}
}