PARALLAX & INFINITE BACKGROUND IN UNITY 🎮 | Create A Endless Background In Unity | Unity Tutorial

Поділитися
Вставка
  • Опубліковано 25 січ 2025

КОМЕНТАРІ • 63

  • @deneb3525
    @deneb3525 3 роки тому +5

    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.

  • @eneseren8332
    @eneseren8332 Рік тому

    Best parallax tutorial i've ever seen! Thank you mate.

  • @schurkino
    @schurkino 3 роки тому +2

    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!

  • @NinjaSamuraiJubei
    @NinjaSamuraiJubei Рік тому

    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.

  • @ludvigludvig5219
    @ludvigludvig5219 3 роки тому +3

    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😎👍

    • @Dani_Krossing
      @Dani_Krossing  3 роки тому +2

      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).

  • @canahmetdarama354
    @canahmetdarama354 2 роки тому +1

    Bro you are awesome with explaining ! ! !

  • @NishanCW
    @NishanCW Рік тому

    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!

  • @bumpleGrumpGames
    @bumpleGrumpGames 2 роки тому +1

    Thanks for the informative lesson! Very helpful and easy to understand!

  • @maddehaan
    @maddehaan 3 роки тому +3

    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.

  • @milomadeagame
    @milomadeagame 2 роки тому +1

    You're a legend!

  • @adhityagunawan4975
    @adhityagunawan4975 3 роки тому

    Glad I found you, keep inspiring dude!

  • @zeroxenator
    @zeroxenator 3 роки тому +1

    You, sir, are a life saver!

  • @michelcastilho6862
    @michelcastilho6862 Рік тому +1

    The parallax movement gets really choppy at higher speeds, how can I fix that?

  • @scholars786
    @scholars786 Рік тому

    You deserve a subscriber button shoot Nice video

  • @WizeLoL
    @WizeLoL 3 роки тому +3

    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?.

  • @Gupatik
    @Gupatik 3 роки тому +1

    hey, I just don't get why we did the 1 - paralleseffect ???

  • @TackleProd
    @TackleProd Рік тому

    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.

  • @Jubez81
    @Jubez81 2 роки тому +1

    can you do a parallax effect without the camera moving?

  • @Giedzilla
    @Giedzilla 3 роки тому +1

    I wonder is there a way to use perspective camera mode without having to scale the background up or making really huge assets?

  • @ProbablyStraight
    @ProbablyStraight 2 роки тому +3

    I tried following this but when i go to the left they disappear one by one

    • @bobbville
      @bobbville Рік тому

      ever any fix for this??? 🤔

  • @chadfatlyf4636
    @chadfatlyf4636 2 роки тому +1

    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?

  • @Elias123dikkiez
    @Elias123dikkiez 8 місяців тому

    hey, sorry for commenting on this old video but why is it jiterring? i wrote the same exact lines but it jitters?

  • @stepbro_davo
    @stepbro_davo 3 роки тому +1

    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.

    • @Dani_Krossing
      @Dani_Krossing  3 роки тому

      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. 🙂

    • @stepbro_davo
      @stepbro_davo 3 роки тому

      @@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

  • @sourabhvijeta3135
    @sourabhvijeta3135 Рік тому

    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.

  • @foreignwarren7361
    @foreignwarren7361 2 роки тому +1

    My Player can jump, and when he does all the layers go up with him, how can i stop this?

  • @payasoprince9333
    @payasoprince9333 Рік тому

    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?

  • @bwolf240
    @bwolf240 3 роки тому +1

    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.

  • @mivuh
    @mivuh 3 роки тому +1

    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?

    • @Dani_Krossing
      @Dani_Krossing  3 роки тому +1

      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.

  • @AlessandroRubeo
    @AlessandroRubeo 2 роки тому +2

    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

    • @Dani_Krossing
      @Dani_Krossing  2 роки тому +1

      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.

    • @Natsnok
      @Natsnok 2 роки тому

      I have the same problem. Whem im moving fast everything becomes dobble. Also if i "build and run" the game

    • @Natsnok
      @Natsnok 2 роки тому +1

      I fixed it :) Try to change the settings of the Camera. Update method to "Fixed update" & blend update methode also to "Fixed update"

    • @TechGuyDane
      @TechGuyDane 2 роки тому +4

      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)

    • @javipachuflo
      @javipachuflo Рік тому

      @@TechGuyDane Dude, you legend. I had the same problem and tried eVeRyThInG and THIS was the problem. Thank you.

  • @dark11demon11
    @dark11demon11 3 роки тому

    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.

  • @RushlineCode
    @RushlineCode 2 роки тому +1

    why not just loop the offset texture of background material?

    • @Dani_Krossing
      @Dani_Krossing  2 роки тому

      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. :)

  • @gurbetcitv2482
    @gurbetcitv2482 Рік тому

    Sorry I'm newbie with coding, so what if we don't want on cam but still parallax bg for 2d game ?

  • @mkshadowzx3093
    @mkshadowzx3093 2 роки тому

    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?

  • @stealthyshiroean
    @stealthyshiroean 3 роки тому

    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.

  • @arbainrahat4578
    @arbainrahat4578 3 роки тому +2

    Please give free video assets. Your style of explaining is great. Keep on Bro

    • @Dani_Krossing
      @Dani_Krossing  3 роки тому +2

      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 🙂

    • @arbainrahat4578
      @arbainrahat4578 3 роки тому

      @@Dani_Krossing yes, please make videos on asset creation.

  • @alifor4
    @alifor4 3 роки тому

    قناتك عباره عن شي احبه

    • @Dani_Krossing
      @Dani_Krossing  3 роки тому

      Jeg går ud fra at du skriver noget positivt 😉

    • @alifor4
      @alifor4 3 роки тому

      @@Dani_Krossing
      Jeg fortalte dig, at jeg elsker dit indhold 😃😍

  • @adorablebabiesandpets2514
    @adorablebabiesandpets2514 3 роки тому

    DANI WE NEED YOU.... LARAVEL IS HARD FOR US TO UNDERSTAND

    • @Dani_Krossing
      @Dani_Krossing  3 роки тому +1

      I have never learned Laravel :) My main focus back 6 years ago when I worked as a multimedia designer, was on front-end dev.

    • @adorablebabiesandpets2514
      @adorablebabiesandpets2514 3 роки тому

      Thanks man...

  • @L-Studio-IT
    @L-Studio-IT Рік тому

    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;
    }
    }
    }

  • @eden3273
    @eden3273 2 роки тому

    Am i the only one who thinks he looks like elon musk? lol

  • @whitesegregator3901
    @whitesegregator3901 3 роки тому

    numbertwoguide

  • @chrisjacobsenn
    @chrisjacobsenn 3 роки тому

    Er du dansker eller hvad?

    • @Dani_Krossing
      @Dani_Krossing  3 роки тому +1

      Jeg er i hvertfald ikke en “hvad” 😛

  • @handlesucks111
    @handlesucks111 Рік тому

    Thank you so much ur wonderful

  • @ereboss6348
    @ereboss6348 2 роки тому +5

    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;
    }
    }