Search Unity

TextMesh Pro TextMesh Pro NullReferenceException: Object reference not set to an instance of an object

Discussion in 'UGUI & TextMesh Pro' started by PieterB, Apr 1, 2017.

  1. PieterB

    PieterB

    Joined:
    Apr 28, 2016
    Posts:
    2
    Updated to Unity 5.6.
    First got error, An assembly with the same name `TextMeshPro' has already been imported, when opening project with Unity 5.6.
    I then restored the old version in 5.5 and removed TextMesh Pro. Rebuild project in 5.6 no error.
    Then reimported TextMesh Pro and got this
    NullReferenceException: Object reference not set to an instance of an object
    TMPro.TMP_Settings.get_defaultFontAsset ()
    TMPro.TextMeshProUGUI.LoadFontAsset ()
    TMPro.TextMeshProUGUI.OnValidate ()

    Tried this also.
    Started a new project and imported TextMesh Pro but again same error
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    As per the release notes, you have to remove / delete the previous TextMesh Pro folder / package before importing the new one. This is simply due to the Asset Importer not being an installer where it has no idea how to handle files that may have been moved or should be deleted, etc.

    Next, there is an issue where the Asset Store may still be providing you with the release for Unity 5.5 instead of the one for Unity 5.6. This can happen when an asset has been downloaded with a previous version of Unity which you then upgraded.

    Clearing the Asset Store cache should resolve this but I am not certain which files need to be cleared and waiting for an answer from the Asset Store team.

    In terms of this error "TMPro.TMP_Settings.get_defaultFontAsset ()"

    This is due to one of the prefabs but not sure why but it should only occur when the package is first imported. This prefab is also part of some examples so not crucial either.
     
  3. PieterB

    PieterB

    Joined:
    Apr 28, 2016
    Posts:
    2
    Thanks for the feedback:
    I have done all the necessary steps as pointed out above. My question was about the error "TMPro.TMP_Settings.get_defaultFontAsset ()" and that you have pointed out as not crucial.

    This mater can then be closed
     
  4. bonzaiferroni

    bonzaiferroni

    Joined:
    May 26, 2016
    Posts:
    30
    I also had this come up, but I noticed that it was originating from a prefab in the Examples folder, and I wasn't planning to use that in my project. Deleting the Examples folder cleared up the issue.
     
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I'll still investigate it since errors are not cool but until then it is harmless.
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I spoke with the Asset Store team and it looks like the Asset Store will provide the version of an asset based on the last version used when you signed on to your Unity account.

    For instance, if you signed on using Unity 5.5 and then upgraded to Unity 5.6, when downloading TextMesh Pro, you will get the release for Unity 5.5 and not for Unity 5.6.

    To address this issue, simply sign off in Unity 5.6 and then sign back on in Unity 5.6. According to the Asset Store folks, this should result in getting the Unity 5.6 release of TextMesh Pro.
     
  7. animal531

    animal531

    Joined:
    Aug 26, 2014
    Posts:
    25
    Also do a restart of your project between deleting the old version and installing the new version, that fixed my issues.
     
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Indeed as once the old DLLs are loaded into memory, it requires closing Unity to unload them even if they were deleted with the previous version.