Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

131
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda