Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to make the scrollSpeed up

Discussion in 'Scripting' started by HungPark, Dec 7, 2019.

  1. HungPark

    HungPark

    Joined:
    Feb 28, 2017
    Posts:
    81
    Hi!

    In the following script, I changed the integer -1.5f into +1.5f to make the background speed up.
    But its speed is the same as before, I mean, not changed.

    public float scrollSpeed = -1.5f

    How to make the speed of the background faster?
    Your help will be very appreciated.

    Sincerely,
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    If that line is in a script that is dragged into any Prefab or Scene, Unity has saved the value and is overwriting what you put in code.

    Go find the script in your scene or prefab and change it there. The above value is only used at the instant in time you construct the object, ie., drag the script onto a GameObject.
     
  3. HungPark

    HungPark

    Joined:
    Feb 28, 2017
    Posts:
    81
    Hi! Kurt-Dekker,

    I have solved this issue thanks to your instruction.
    I took the following path.

    Scenes(in Project View) --> Main(in Hierarchy View) --> GameController --> Scroll Speed (in Inspector View).

    Thank you again!

    Merry X-mas and Happy New Year.
     
    Kurt-Dekker likes this.