Search Unity

[Critical Bug]: FormatException: Input string was not in a correct format.

Discussion in 'Timeline' started by marserMD, Jun 20, 2018.

  1. marserMD

    marserMD

    Joined:
    Aug 29, 2014
    Posts:
    178
    This is what I get when trying to animate object's position:
    Code (CSharp):
    1. FormatException: Input string was not in a correct format.
    2. System.Number.ParseSingle (System.String value, System.Globalization.NumberStyles options, System.Globalization.NumberFormatInfo numfmt) (at <e1a80661d61443feb3dbdaac88eeb776>:0)
    3. System.Single.Parse (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) (at <e1a80661d61443feb3dbdaac88eeb776>:0)
    4. System.Single.Parse (System.String s) (at <e1a80661d61443feb3dbdaac88eeb776>:0)
    5. UnityEditor.Timeline.TimelineRecording.GetCurrentPositionAndRotation (UnityEditor.UndoPropertyModification[] mods, UnityEngine.Vector3& position, UnityEngine.Quaternion& rotation) (at C:/buildslave/unity/build/Extensions/Timeline/Editor/Recording/TimelineRecording_Monobehaviour.cs:524)
    6. UnityEditor.Timeline.TimelineRecording.RemoveOffsets (UnityEditor.UndoPropertyModification modification, UnityEngine.Timeline.AnimationTrack track, UnityEngine.Timeline.TimelineClip clip, UnityEditor.UndoPropertyModification[] mods) (at C:/buildslave/unity/build/Extensions/Timeline/Editor/Recording/TimelineRecording_Monobehaviour.cs:381)
    7. UnityEditor.Timeline.TimelineRecording.ProcessMonoBehaviourModification (UnityEditor.UndoPropertyModification[] modifications, UnityEditor.Timeline.WindowState state) (at C:/buildslave/unity/build/Extensions/Timeline/Editor/Recording/TimelineRecording_Monobehaviour.cs:114)
    8. UnityEditor.Timeline.TimelineRecording.ProcessUndoModification (UnityEditor.UndoPropertyModification[] modifications, UnityEditor.Timeline.WindowState state) (at C:/buildslave/unity/build/Extensions/Timeline/Editor/Recording/TimelineRecording.cs:19)
    9. UnityEditor.Timeline.TimelineWindow.PostprocessAnimationRecordingModifications (UnityEditor.UndoPropertyModification[] modifications) (at C:/buildslave/unity/build/Extensions/Timeline/Editor/Window/TimelineWindow_EditorCallbacks.cs:105)
    10. UnityEditor.Undo.InvokePostprocessModifications (UnityEditor.UndoPropertyModification[] modifications) (at C:/buildslave/unity/build/artifacts/generated/bindings_old/common/Editor/UndoBindings.gen.cs:196)
    upload_2018-6-20_17-42-9.png
    After this, the animation doesn't record and the timeline might even refuse to record any further animations (not sure about the conditions for that)

    Environment:
    - Windows 7 (tried both with ',' and '.' decimal separator)
    - Unity 2018.1.2f1
    - .net 4.x (important! on 3.5 everything seems to work)
    - Cinemachine 2.2.0 from the package manager

    Steps to reproduce:
    1. Setup the environment as described above
    2. Create a scene.
    3. Create a timeline on an empty game object.
    4. Create a cube, set it's position to (1, 0, 0) (important! Everything seems to work correctly with position (0, 0, 0)
    5. Drag that cube on the timeline, select animation track
    6. Press the record button
    7. Lock the timeline window
    8. Try to move the cube along one the x-axes
    9. Observe the error and failure to record that keyframe

    Steps to reproduce in the attached project:
    1. Open Scenes/SampleScene
    2. Click on the "GameObject"
    3. Lock the timeline window
    4. Press record button for "Sphere"
    5. Select "Sphere"
    6. Move sphere along the x-axes
    7. Observe the error and failure to record that keyframe

    What do I think is faulty?
    I can't help but notice that you use:
    float.Parse(serializedValue)

    While Unity always uses:
    float.TryParse(serializedValue, NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture.NumberFormat, out result);

    And using the right NumberFormat is a very important thing when it comes to [de]serializing floats. So even it is not the source of the problem, I suggest you take advantage of that.
     

    Attached Files:

  2. marserMD

    marserMD

    Joined:
    Aug 29, 2014
    Posts:
    178
    Also reported bug Case 1051325.
    Because I'm not sure whether I should report it to Unity or here on forum:)
     
  3. marserMD

    marserMD

    Joined:
    Aug 29, 2014
    Posts:
    178
    Also, there is a Unity Crash that occurs when adding a keyframe to the timeline. Please note that it is also related to NumberFormat.
    Attaching editor log and a screenshot.
     

    Attached Files:

  4. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    961
    Thanks for the report! I like it when the bug reports also contain the fix ;)

    We'll get it addressed asap.
     
    marserMD likes this.
  5. sanya_kotov

    sanya_kotov

    Joined:
    Feb 17, 2015
    Posts:
    2
    Get the same error when just try record animation in timeline window. Animation not records.
    Unity 2018.2
     
  6. Fishing_Cactus

    Fishing_Cactus

    Joined:
    Nov 8, 2014
    Posts:
    11
    Do you have some news about this bug?
     
  7. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    961
    The fix is currently in QA. With luck it will be in a release soon.
     
    marserMD likes this.
  8. Fishing_Cactus

    Fishing_Cactus

    Joined:
    Nov 8, 2014
    Posts:
    11
    Thanks for your reply.