Unity Beginners - How to Loop the Background Image

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

КОМЕНТАРІ • 43

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

    For anyone trying to get it to cycle any direction(though slightly worse on performance because of Mathf.Abs) is to put two children like this, one on the bottom. And instead of checking if it's less than the height, use MathfAbs to check if it's greater than it.(for those who don't know, Mathf.Abs puts the number in the positive if it's negative)

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

    Thank you! This was very helpful, and you explained it so well.

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

    Your "okay" sounds very adamant.

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

    Nice, You make me understand its logic !!

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

    Great tutorial. Thanks, man

  • @tirkdiamond
    @tirkdiamond 3 роки тому +4

    that was great! thank you so much!

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

      I guess I am kinda randomly asking but do anyone know a good site to watch new movies online ?

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

    This was so awesome - thank you!

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

    Hey all, Nice quick script! Here's an easy way to math out the position of the image, and what value your IF should be: In your project tab, click on the image you will be using! This will show information about your image. The numbers you need are Height of the Image in Pixels [the very bottom should show ####x####. The first is width, second is height] And you need Pixels Per Unit [by default this is 100]
    Youll want to do height / pixels per unit. You should set your second image Y Position to this value, And the if(transform.position.y < _____) in the script!
    Make any seamless image work!!! [Note: you can do this all progmatically too, but art brain likes the visual]

  • @LinseFabiyola
    @LinseFabiyola 21 день тому

    Thank you so much!!

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

    So now I know why mine did not work right. I tried to do it on my own and was messing up because I did not.make the second duplicate a child of the first one.
    I have a script for each BG and lopped each one. Which worked for a split second then got out of time with each other.
    But now I see how it can be fixed after this video. Thanks for sharing.

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

    why my looping is not smooth, any solution?

  • @irairainu
    @irairainu 4 роки тому +1

    This is really helpful! Thanks!

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

    Thanks, you helped me!

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

    thank u very much...very helpful....

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

    I can took the speed in unity but my background is not moving, whats wrong here?
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class repeat : MonoBehaviour
    {
    public float speed = 4f;
    private Vector3 StartPosition;
    void Start()
    {
    StartPosition = transform.position;
    }
    //update is called once per frame
    void Update()
    {
    transform.Translate(translation: Vector3.down*speed*Time.deltaTime);
    if (transform.position.y < 0.18f )
    {
    transform.position = StartPosition;
    }
    }
    }
    THX

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

    the only problem is that it doesn't work smooth for me.. It like jumps every time when it returns to the starting point

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

      If it loops, then you got the code right. if the jump is visible, then its all about minute adjustments in the position of the image. try moving the starting position of the image slightly and see how much jump is visible. if the jump gets more obvious, then adjust the starting position in the opposite direction. good luck

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

      try using fixedUpdate instead of update

  • @stungman
    @stungman 4 роки тому

    it worked ! Thank you .

  • @Rohan-lz6ix
    @Rohan-lz6ix 4 роки тому

    Can you tell me the program you made the space ship

    • @adamantalgorithm9595
      @adamantalgorithm9595  4 роки тому +1

      I did not make it, actually. It was downloaded from craftpix.net/

    • @Rohan-lz6ix
      @Rohan-lz6ix 4 роки тому

      Thanks man, can you recomend a program which are for free and you can make good sprites?

    • @adamantalgorithm9595
      @adamantalgorithm9595  4 роки тому

      @@Rohan-lz6ix GIMP is completely free and it is Photoshop equivalent. Take a look - www.gimp.org/ OR Krita is also a good tool.

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

      @@Rohan-lz6ix Was ein Zufall das man sich hier nach 5 Monaten trifft.. xD

    • @Rohan-lz6ix
      @Rohan-lz6ix 3 роки тому

      @@kaborid_865 mein Freund

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

    Amazing!

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

    Danke hat mir sehr geholfen

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

    can you do it on Visual Scripting, please.

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

    please do more! 🥰🥰🥰🥰🥰🥰

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

    woow..Thank u very much

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

    ICH WILL EIN KIND VON DIR!!!!!!

  • @golfey9022
    @golfey9022 4 роки тому

    Script