Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
Clamp smoothly for layout

I am using Mathf.Clamp to clamp 2 values for the vertical scroll view. Unfortunately there is a noticeable jitter when I try to scroll more than required value. The two values I clamp is between 0.5 and 1. But I notice that it goes below 0.5 and above 1 when I scroll (minimum value it goes is between 4.6-4.9 and max is 1.1-1.3). Could these values be fixed so that there won't be a jitter?

public ScrollRect scrollRect;

void Update () {
  Debug.Log(scrollRect.verticalScrollbar.value);
  scrollRect.verticalScrollbar.value = Mathf.Clamp(scrollRect.verticalScrollbar.value, 0.5f, 1);
}
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I guess your update is being executed before the ScrollRect update, so your Clamp could be overwritten by the ScrollRect's update (I'm not sure if this explanation is clear). If this is the case, using LateUpdate instead of Update would fix your problem. https://docs.unity3d.com/ScriptReference/MonoBehaviour.LateUpdate.html

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!