Search Unity

Bug Null Reference Error from Textmeshpro Inputfield when trying to save in a prefab

Discussion in 'UGUI & TextMesh Pro' started by Havie, Oct 29, 2022.

  1. Havie

    Havie

    Joined:
    Oct 12, 2019
    Posts:
    89
    Hello when I am trying to add a default "input field" to a prefab with all base settings, saving that prefab results in an error.

    Steps to reproduce:
    1. Make a prefab
    2. Open prefab
    3. Right click add -> UI -> Inputfield Text mesh pro
    4. Try saving prefab
    5. Observe error


    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. TMPro.TMP_SubMeshUI.UpdateMaterial () (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMP_SubMeshUI.cs:710)
    3. TMPro.TMP_SubMeshUI.SetMaterialDirty () (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMP_SubMeshUI.cs:617)
    4. UnityEngine.UI.MaskableGraphic.RecalculateMasking () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/MaskableGraphic.cs:301)
    5. UnityEngine.UI.MaskUtilities.NotifyStencilStateChanged (UnityEngine.Component mask) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/MaskUtilities.cs:46)
    6. UnityEngine.UI.Mask.OnValidate () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Mask.cs:131)
    7. System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0)
    8. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    9. System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0)
    10. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0)
    11. UnityEngine.UI.Graphic.OnRebuildRequested () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/Graphic.cs:796)
    12. UnityEngine.UI.GraphicRebuildTracker.OnRebuildRequested () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/GraphicRebuildTracker.cs:54)
    13. UnityEngine.CanvasRenderer.RequestRefresh () (at <dc56479238874a218f509da0e4e322d7>:0)
    14. UnityEditor.EditorApplication:Internal_CallGlobalEventHandler()
    15.  

    upload_2022-10-29_11-15-8.png