Legacy Documentation: Version 2017.2 (Go to current version)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

ScrollRect.decelerationRate

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public var decelerationRate: float;
public float decelerationRate;

Description

The rate at which movement slows down.

The deceleration rate is the speed reduction per second. A value of 0.5 halves the speed each second. The default is 0.135. The deceleration rate is only used when inertia is enabled.

#pragma strict
// Required when Using UI elements.
public var myScrollRect;
public function Start() {
    // The higher the number the longer it takes to decelerate.
    myScrollRect.decelerationRate = 5.0f;
}
using UnityEngine;
using System.Collections;
using UnityEngine.UI; // Required when Using UI elements.

public class ExampleClass : MonoBehaviour { public ScrollRect myScrollRect;

public void Start() { // assigns a new value to the decelerationRate of the scroll rect. // The higher the number the longer it takes to decelerate. myScrollRect.decelerationRate = 5.0f; } }

Did you find this page useful? Please give it a rating: