Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Input String Was Not In A Correct Format

Discussion in '2019.2 Beta' started by Ikingi, Apr 10, 2019.

  1. Ikingi

    Ikingi

    Joined:
    Jun 9, 2018
    Posts:
    4
    Hi, everything worked up to 2018.2.5f1, on all newer versions I get this error. It appears when I import a text file with settings into the script. What has changed in unity and how to fix it?

    Code (CSharp):
    1. FormatException: Input string was not in a correct format.
    2. System.Number.ParseDouble (System.String value, System.Globalization.NumberStyles options, System.Globalization.NumberFormatInfo numfmt) (at <23c160f925be47d7a4fd083a3a62c920>:0)
    3. System.Double.Parse (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) (at <23c160f925be47d7a4fd083a3a62c920>:0)
    4. System.Double.Parse (System.String s, System.IFormatProvider provider) (at <23c160f925be47d7a4fd083a3a62c920>:0)
    5. System.Convert.ToDouble (System.String value) (at <23c160f925be47d7a4fd083a3a62c920>:0)
    6. fs.ClipRetargeting.Load (System.Byte[] data, System.Boolean fromAsset) (at Assets/Faceshift/Base/Scripts/Utils/ClipRetargeting.cs:412)
    7. fs.ClipRetargeting.Load (System.String filename) (at Assets/Faceshift/Base/Scripts/Utils/ClipRetargeting.cs:371)
    8. fs.Faceshift.LoadRetargetingFromFile (System.String path) (at Assets/Faceshift/Animation/Scripts/Faceshift.cs:112)
    9. FaceshiftEditor.OnInspectorGUI () (at Assets/Faceshift/Animation/Editor/FaceshiftEditor.cs:145)
    10. UnityEditor.UIElements.InspectorElement+<CreateIMGUIInspectorFromEditor>c__AnonStorey1.<>m__0 () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorElement.cs:475)
    11. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    12.  
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,646
    "Assets/Faceshift/Base/Scripts/Utils/ClipRetargeting.cs" is that your code? It probably doesn't specify which locale to use when parsing numbers so it defaults to your computer locale, which probably uses commas instead of periods as decimal separators.
     
  3. Ikingi

    Ikingi

    Joined:
    Jun 9, 2018
    Posts:
    4
    Oh, thank you very much, somehow didn't guess to this.

    I just changed the line
    Code (CSharp):
    1. Convert.ToDouble(elements[3].Trim ());
    to
    Code (CSharp):
    1. Convert.ToDouble(elements[3].Trim (), System.Globalization.CultureInfo.CreateSpecificCulture("en-US"));
    and everything works again.
     
  4. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    880
    Same problem here. Unity 2019.4, HDRP 7.4.1 latest amplify shader editor, default locale: ru
    Reproducable steps:
    Create Unlit Shader
    Save it and close it.
    Open it.
    Infinite loops of errors:

    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 <437ba245d8404784b9fbab9b439ac908>:0)
    3. System.Single.Parse (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) (at <437ba245d8404784b9fbab9b439ac908>:0)
    4. System.Single.Parse (System.String s, System.IFormatProvider provider) (at <437ba245d8404784b9fbab9b439ac908>:0)
    5. System.Convert.ToSingle (System.String value) (at <437ba245d8404784b9fbab9b439ac908>:0)
    6. AmplifyShaderEditor.InlineProperty.ReadFromSingle (System.String singleLine) (at Assets/AmplifyShaderEditor/Plugins/Editor/Utils/InlineProperty.cs:260)
    7. AmplifyShaderEditor.TemplateOptionsUIHelper.SetReadOptions () (at Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUIHelper.cs:805)
    8. AmplifyShaderEditor.TemplateMultiPassMasterNode.SetReadOptions () (at Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassMasterNode.cs:546)
    9. AmplifyShaderEditor.TemplateMultiPassMasterNode.OnRefreshLinkedPortsComplete () (at Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassMasterNode.cs:539)
    10. AmplifyShaderEditor.ParentGraph.OnRefreshLinkedPortsCompleteInternal (AmplifyShaderEditor.UsageListTemplateMultiPassMasterNodes masterNodes) (at Assets/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs:3143)
    11. AmplifyShaderEditor.ParentGraph.OnRefreshLinkedPortsComplete () (at Assets/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs:3131)
    12. AmplifyShaderEditor.ParentGraph.Draw (AmplifyShaderEditor.DrawInfo drawInfo) (at Assets/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs:1299)
    13. AmplifyShaderEditor.AmplifyShaderEditorWindow.LoadObject (UnityEngine.Object objToLoad) (at Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs:1418)
    14. AmplifyShaderEditor.AmplifyShaderEditorWindow.OnGUI () (at Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs:4793)
    15. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    16. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    17. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    18. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
    19. UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at <af78ad00a40d4f61b82afc6cafb0a416>:0)
    20. UnityEditor.HostView.Invoke (System.String methodName) (at <af78ad00a40d4f61b82afc6cafb0a416>:0)
    21. UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <af78ad00a40d4f61b82afc6cafb0a416>:0)
    22. UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <af78ad00a40d4f61b82afc6cafb0a416>:0)
    23. UnityEditor.DockArea.OldOnGUI () (at <af78ad00a40d4f61b82afc6cafb0a416>:0)
    24. UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    25. UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    26. UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    27. UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    28. UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    29. UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    30. UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    31. UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    32. UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    33. UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    34. UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    35. UnityEngine.UIElements.EventDispatcher.OpenGate () (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    36. UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    37. UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    38. UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    39. UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    40. UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    41. UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
    42. UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <819de1aa368e45faa4f78e26c97c62b0>:0)
    43.  
     
  5. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    880
    Any workaround would be highly appresiated
     
  6. Gnoblar_agency

    Gnoblar_agency

    Joined:
    Sep 20, 2012
    Posts:
    8
    I am also getting this with Amplify Shader Editor