Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

132
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda