Slider graphic shakes when changing slider.value from code

We discovered the bug while our team developped a custom way of interacting with sliders with the finger. Basically, the when the finger is close to the slider, the finger position is resolved on the slider’s axis and used to move adequately the slider. Slider is affected only through the modification of the slider.value property.

snip of code :

float point = Vector3.Dot(transform.right.normalized, fingerTipPosition - colliderStart);

float percentAlongSlider = (point) / colliderWorldWidth;
float result = sliderWidth * percentAlongSlider + sliderStartValue;
m_UnitySlider.value = result;

But when built for the VisionOS platform and tested in the headset (I havent tested in the simulator), it behaves as such :
SliderIssue1

Note that the UGUI slider with native interaction system also has that lag (taken from PolySpatial samples scene UGUI):
SliderIssue2

Expected behavior : The left side of the slider should stay still.
This does not happen when we reproduce the situation in the Editor at runtime.

Also, I observed the same issue on a slider used as loading bar for our app. The slider component is inactive and I simply change the value of the RectTransform delta size like this :

LeanTween.size(m_SliderFillArea, m_SliderParent.sizeDelta, wLoadTime).setEaseOutQuad();

// which ultimately just changes the size delta of the rect transform 

public LTDescr setCanvasSizeDelta(){
        this.type = TweenAction.CANVAS_SIZEDELTA;
        this.initInternal = ()=>{ this.from = this.rectTransform.sizeDelta; };
        this.easeInternal = ()=>{ this.rectTransform.sizeDelta = easeMethod(); };
        return this;
    }

Which makes me think that the issue is not related to sliders specifically, but related to the rendering (refreshrate?) of the RectTransforms and their anchor points.

Other things to consider that might affect the behavior :

  • General performance
  • Lossy scale on slider

I would appreciate some feedback in order so see if I can do something to fix this lag on my end.

Thank you!

Yes, the issue is with synchronization of mesh and transform changes. What version of Unity/PolySpatial/visionOS are you seeing this with? We have some fixes that should help with this (specifically, avoiding the creation of new RealityKit colliders, which causes significant slowdown in UI) that will be released in the next versions of PolySpatial, and Apple also has done some work to address this issue in visionOS 2.0 (“Fixed: Updates to LowLevelMesh and LowLevelTexture might appear out-of-sync relative to changes made to Entities in the same frame. (117234258)”).

Please note that 2D-Animation and 2D-Graphics refer to those specific features in Unity so please only use them when discussing those features otherwise your post appears in the 2D product area which is not related to UI systems such as UGUI.

I’ll remove those tags for you.

Thanks.

Hello, we are using Unity 2022.3.37f1, PolySpatial 1.3.1, and Testing on VisionOS 1.3. Thanks for the info, will be looking forward to the next update !

We also made a change to the samples in 1.3.9 that addressed this issue specifically: switching to the Fill image type for the slider fill image. You might want to retry with the slider sample from that version, though we do have an additional fix pending that should improve general UI performance.