Search Unity

TextMesh Pro TMP doesn't like prefabs

Discussion in 'UGUI & TextMesh Pro' started by CDF, Aug 18, 2020.

  1. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,311
    Using version 3.0.1
    When trying to create a new UI TextMesh object in any prefab mode. I get this error:

    Code (CSharp):
    1. ArgumentException: Gameobject is not a root in a scene
    2. UnityEngine.SceneManagement.SceneManager.MoveGameObjectToScene (UnityEngine.GameObject go, UnityEngine.SceneManagement.Scene scene) (at <49f4e7e791cc4fffacd88f729e2b1e4c>:0)
    3. TMPro.EditorUtilities.TMPro_CreateObjectMenu.PlaceUIElementRoot (UnityEngine.GameObject element, UnityEditor.MenuCommand menuCommand) (at Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Editor/TMPro_CreateObjectMenu.cs:253)
    4. TMPro.EditorUtilities.TMPro_CreateObjectMenu.CreateTextMeshProGuiObjectPerform (UnityEditor.MenuCommand menuCommand) (at Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Editor/TMPro_CreateObjectMenu.cs:116)
    5. UnityEditor.GenericMenu:CatchMenu(Object, String[], Int32)
    6.  
    The text is created, but not under the hierarchy I desire.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    What version of Unity are you using?

    And what are the steps to re-create the above behavior?

    EDIT:

    The issue appears to be related to the fact a Canvas needs to be added and the text object a child of that new Canvas. For some reason, the object creation handling used in a normal scene isn't handled correctly in Prefab isolation mode. Will look further into it later this afternoon.
     
    CDF likes this.
  3. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,311
    I'm using 2020.1.2
    I can submit a bug if you like. Pretty easy to reproduce
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I have been able to reproduce and resolve this issue.

    The fix will be included in the next release of the TMP package.
     
    quyrean and CDF like this.
  5. quyrean

    quyrean

    Joined:
    Nov 29, 2016
    Posts:
    16
    Thanks. I just ran into this myself - it also sets the scale of the object to 2.

    Will the new text object I just created (that gave an error) be usable or should I exit prefab mode, create the object and then apply to the prefab? Basically can I ignore the error and continue?
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Everything should work fine outside of prefab isolation mode. This issue is specific to the creation context menu while in prefab isolation mode.
     
  7. Milo_del_mal

    Milo_del_mal

    Joined:
    Jan 27, 2013
    Posts:
    43
    Is there an ETA for this fix?
    Otherwise I have to work with 2.0.1, which has a bug with the TMP Dropdowns giving null references.
     
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    This issue has been fixed but I am still putting the final touch in the next release which I really want to release next week.

    In terms of the Prefab issue, this only occurs in Isolation mode. If you make the changes in the scene, it should be fine. Furthermore, the issue is related to the text object not being created as a child of the Canvas which is something that can be fixed manually in prefab isolation mode if needed.

    Are you running into some other issue?
     
  9. paradizIsCool

    paradizIsCool

    Joined:
    Jul 10, 2014
    Posts:
    178
    3.0.1 unity 2020.1.9, still have this issue, is this normal?
     
  10. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    This fix will be in the next release which is expected to be version 1.5.2 for Unity 2018.4, version 2.1.2 for Unity 2019.4 and version 3.0.2 for Unity 2020.x.

    I really really want to release these tomorrow.
     
  11. Gillissie

    Gillissie

    Joined:
    May 16, 2011
    Posts:
    305
    I just found this bug, and this thread for the solution. I'm in Unity 2020.2.2f1 and upgraded TMPro to 3.0.5, and now get this error in three places:
    Library/PackageCache/com.unity.textmeshpro@3.0.5/Scripts/Runtime/TMP_InputField.cs(429,42): error CS0117: 'RuntimePlatform' does not contain a definition for 'PS5'

    [edit] Also, the upgrade didn't solve the original issue.
     
  12. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Looks like PS5 support was added in 2020.2.3f1.

    In terms of the initial issue reported in this thread, this should have been fixed so let's see if I can first remember the steps to reproduce it and then figure out what is up.

    UPDATE
    I was able to track down the original report where everything appears to be working as expected using 3.0.4 or 3.0.5.

    I also installed 2020.2.2f1 with 3.0.5 and everything is working as expected with the exception of the PS5 issue.

    Can you provide the steps to reproduce the issue you are running into?
     
    Last edited: Apr 16, 2021
  13. Gillissie

    Gillissie

    Joined:
    May 16, 2011
    Posts:
    305
    Ok, now it works. I guess something didn't get fully updated the first time I upgraded to 3.0.5, so it was still happening. After downgrading to 3.0.4, then reimporting the entire project, then re-upgrading to 3.0.5, the original issue is fixed. Thanks for the quick replies.
     
    Stephan_B likes this.
  14. kenorta

    kenorta

    Joined:
    Nov 29, 2019
    Posts:
    1
    Hey im still getting the issue, i just dragged a prefab into my scene and it give me the error on start up

    Edit: it is caused when there is no event system object
     
    Last edited: Jun 26, 2021
    Stephan_B and quyrean like this.