Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug TMP 4.0 Font Sprite Bug When Changing Sprite Name

Discussion in 'UGUI & TextMesh Pro' started by MousePods, Feb 25, 2022.

  1. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    808
    4.0.pre1

    Create > Text > Sprite Asset.

    Change the name of one of the sprites you get this error

    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.TextCore.Text.SpriteCharacterPropertyDrawer.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at /Users/bokken/buildslave/unity/build/Modules/TextCoreTextEngineEditor/Managed/SpriteCharacterPropertyDrawer.cs:86)
    UnityEditor.PropertyDrawer.OnGUISafe (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at /Users/bokken/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyDrawer.cs:23)
    UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.Rect visibleArea) (at /Users/bokken/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:173)
    UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at /Users/bokken/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:134)
    UnityEditor.PropertyHandler.OnGUILayout (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at /Users/bokken/buildslave/unity/build/Editor/Mono/ScriptAttributeGUI/PropertyHandler.cs:286)
    UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at /Users/bokken/buildslave/unity/build/Editor/Mono/EditorGUI.cs:10847)
    UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUILayoutOption[] options) (at /Users/bokken/buildslave/unity/build/Editor/Mono/EditorGUI.cs:10831)
    UnityEditor.TextCore.Text.TextSpriteAssetEditor.OnInspectorGUI () (at /Users/bokken/buildslave/unity/build/Modules/TextCoreTextEngineEditor/Managed/TextSpriteAssetEditor.cs:255)
    UnityEditor.UIElements.InspectorElement+<>c__DisplayClass62_0.<CreateIMGUIInspectorFromEditor>b__0 () (at /Users/bokken/buildslave/unity/build/ModuleOverrides/com.unity.ui/Editor/Inspector/InspectorElement.cs:645)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
     
  2. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    808
    @Stephan_B This also is happening in 3.2.0pre2. Is there any solution coming soon. Makes it impossible to change the name and hinders workflow =(
     
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I addressed this issue last night. The fix will be included in 3.2.0-pre.3 of the TMP package.

    I won't be updating version 4.0.0 yet as this version is strictly for users using UI Toolkit and TMP where they wish to share resources between the two. Please be mindful of the following information before updating to version 4.x.

    *** READ BEFORE UPGRADING ***
    ---------------------------------
    This preview version of the TextMeshPro package is for users seeking to use both UI Toolkit and TextMeshPro in the same project.
    DO NOT UPGRADE to this new release unless you are planning on using UI Toolkit and sharing resources between TMP and UITK.
    This new release uses new asset types that are no longer included in the package and now instead included with the Unity Editor itself. As such, you will no longer have access to the source code for these assets, editors and other related script files.
    In order to share resources between TMP and UITK, existing TMP resources such as TMP_FontAssets, TMP_SpriteAssets, and other TMP assets will need to be converted to these new internal asset types along with remapping of their GUID.
    All scripts and project files referencing these TMP assets will be updated via the Unity API Updater. Since these changes cannot be undone, please BE SURE TO BACKUP YOUR PROJECT before updating to this new release.
    Once the Unity API Updater has run, you will need to restart the Unity editor for this asset migration process to complete.
    TMP Essential Resources and TMP Examples & Extras have been updated in this release and should be re-imported.
    --------------------
     
    MousePods likes this.