Search Issue Tracker
Fixed in 5.6.0
Votes
17
Found in
5.6.0b7
Issue ID
881819
Regression
Yes
Viewport content position values breaks to NaN value when changing Scroll Rect position (can not undo)
Reproduction steps:
1. Open project attached (ScrollRectTest.zip).
2. Open scene "test".
3. Press on Scroll Rect (in Canvas).
4. Drag it by X.
Expected result: Scroll Rect moves with all its content.
Actual result: Content (Scroll Rect -> Viewport) rect transform position breaks (becomes NaN) and unable to undo it.
Reproduced on: 5.6.0b2, 5.6.0b7, 5.6.0b9.
Works fine in: 5.5.1p4, 5.6.0b1.
Regression introduced in: 5.6.0b2.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Unable to change the Shadow Map resolution for lights via Inspector when 'preserveCachedShadow' is enabled
- Adaptive Probe Volumes are not loaded when Adaptive Light Probes are exported via Asset Bundles and opened on another project
- Sprites are not present in Player when built
- TrackPropertyValue callback stops being called when modifying PropertyField
- [Android] [Particle System] "ParticleSystem.GeometryJob" sometimes takes up to ~20 ms in the worker thread when initializing 5 Particle Systems
Chris-Android
Apr 21, 2017 22:56
I tried the 'Clamped' option and for some odd reason was unsuccessful....so I created this script. I hope it'll help those who are also in the same position as me.
#if UNITY_EDITOR && UNITY_5_6
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
public class ScrollRectNANEditor : EditorWindow
{
static ScrollRectNANEditor _window;
[MenuItem("ScrollRect (5.6) Bug Fixer/Open Window #F9")]
public static void Open()
{
if (_window != null)
EditorWindow.GetWindow<ScrollRectNANEditor>().Close();
//Show existing window instance. If one doesn't exist, make one.
_window = EditorWindow.GetWindow<ScrollRectNANEditor>("", true, typeof(SceneView)) as ScrollRectNANEditor;
}
[MenuItem("ScrollRect (5.6) Bug Fixer/Fix Now")]
public static void LaunchBootScreen()
{
Open();
_window.FixBug();
}
void OnGUI()
{
if (GUILayout.Button ("Fix Now", EditorStyles.toolbarButton))
FixBug();
}
void FixBug()
{
ScrollRect[] scrolls = FindObjectsOfType(typeof(ScrollRect)) as ScrollRect[];
for (int i = 0; i < scrolls.Length; i++)
{
ScrollRect scroll = scrolls[i];
scroll.enabled = false;
}
for (int i = 0; i < scrolls.Length; i++)
{
ScrollRect scroll = scrolls[i];
if (scroll.movementType == ScrollRect.MovementType.Clamped)
{
scroll.movementType = ScrollRect.MovementType.Elastic;
scroll.elasticity = 0;
}
if (scroll.content != null)
{
scroll.content.anchoredPosition = FixIfNaN(scroll.content.anchoredPosition);
}
}
for (int i = 0; i < scrolls.Length; i++)
{
ScrollRect scroll = scrolls[i];
scroll.enabled = true;
}
_window.ShowNotification(new GUIContent(scrolls.Length + " instances have been successfully fixed ;)"));
}
Vector2 FixIfNaN(Vector2 v)
{
v.x = v.x.FixIfNaN();
v.y = v.y.FixIfNaN();
return v;
}
Vector3 FixIfNaN(Vector3 v)
{
v.x = v.x.FixIfNaN();
v.y = v.y.FixIfNaN();
v.z = v.z.FixIfNaN();
return v;
}
}
#endif
Genebris
Apr 18, 2017 19:16
Thank you, PhaneV. Changing from clamped to elastic solved it.
AbelSierraSanchez
Apr 14, 2017 15:33
This happens to me in the current version 5.6.0f3.
The solution to avoid this till they fix this bug is the one that PHANEV said:
This issue stopped reproducing after I changed the Movement Type of the scroll rect to "Elastic". Was previously using "Clamped".
Ederic
Apr 13, 2017 09:57
We are having the same problem, scroll rect value goes to NAN when we move it. In 5.6.0f3
pixelsplit
Apr 11, 2017 09:16
So is there gonna be a fix for 5.6 too or will this be only fixed in 2017? o.O
MrLucid72
Apr 09, 2017 15:44
Really messes up our UI in 5.6f3
PhaneV
Apr 07, 2017 20:12
Further on:
This issue stopped reproducing after I changed the Movement Type of the scroll rect to "Elastic". Was previously using "Clamped".
I tried this after finding this bug here, which might be related (?) :
https://issuetracker.unity3d.com/issues/rect-transform-values-are-set-to-nan-when-decreasing-the-height-of-the-content-game-object-in-scroll-view
PhaneV
Apr 07, 2017 20:08
Happens in 5.6.0f2 Personal.
Thanks @ Egproject, otherwise I would've updated to try on it too.
uzihead
Apr 07, 2017 16:09
The issue is still present in 5.6.0f3 Plus. All my drop downs got broken with the update, unfortunately. Scroll rect still unusable unless ready to redo it 100 times until you get lucky.
EGProject
Apr 07, 2017 08:48
Reproduces with 5.6.0f3 Personal