Search Unity

TextMesh Pro Prefab modifications which won't go away

Discussion in 'UGUI & TextMesh Pro' started by OndrejP, Feb 1, 2019.

  1. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    304
    I'm getting prefab modification which won't go away.
    Even when I reset one, the other appears.

    Don't mind subclass of TextMeshPro, it happens in exactly same manner when I'm using original class or just comment out LateUpdate method.

    It's quite annoying since it clutters the UI a lot.
    Is it fixed in 1.4.0 beta? I'm using 1.3.0 in production, but if beta solves it, I would switch to it.

    The problematic properties:
    m_isInputParsingRequired
    m_havePropertiesChanged
    Mesh (in MeshFilter)

    Code (CSharp):
    1. public class TextMeshProFast : TMPro.TextMeshPro
    2. {
    3.     private void LateUpdate()
    4.     {
    5.         // This is defined to disable private LateUpdate in base class
    6.         // Base class implementation detects scale changes and updates text
    7.         // It takes 0.64ms for 1530 instances
    8.     }
    9. }
    10.  
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The first
    The first 3 on this list have been solved.

    The Mesh filter is a special case which will require special handling that I didn't have time to address in the preview of 1.4.0 and will address in subsequent release.
     
  3. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    304
    Thanks for answer, isn't it possible to just assign mesh instead of sharedMesh?

    EDIT:
    I see you're assigning both mesh and sharedMesh in the code, I'm probably missing something
     
    Last edited: Feb 1, 2019
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The issue has to do with the mesh not being persistent which is by design and although being set to HideAndDontSave still being tacked by the prefab system because of the Mesh Renderer component.

    In a way this should be handled similarly to driven properties like in the case of a RectTransform affected by a layout component that changes the size of the RectTransform where in this case, although the values are changing, the Prefab system is ignoring them.
     
  5. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    304
    Would it work to render mesh through Graphics.DrawMesh?
    Does it have any drawbacks? (performance, lightmapping not working etc...)

    It seems imo like awful lot of work to use driven properties which are currently only supported on RectTransform.

    EDIT: Or command buffer DrawMesh
     
    Last edited: Feb 1, 2019
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I need to have another conversation with the Prefab team as I believe this scenario / case should be handled by the Prefab system where for instance a Mesh that is using the HideFlags.HideAndDontSave should be ignored.

    Again, the issue has to do with the Mesh Filter component which although hidden in the inspector has this serialized property which the prefab system tracks.
     
  7. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    304
    Thanks, it would be nice if prefabs ignored HideAndDontSave fields (or considered them null)
     
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Indeed. I think that would be the cleanest way to handle this not only in this case but for other use cases.
     
  9. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    Any news on this?
     
  10. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The only remaining issues should be related to the Mesh Filter.

    I'll check again with the prefab team to see if they have a solution for this.
     
  11. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    304
    I can confirm this, the only thing which remains in "overrides" UI in 2019.1.10f is MeshFilter.
    Hope to see this resolved soon as it clutters the "overrides" UI :)

    Would it be possible to use hide flags "HideInInspector | DontSave" instead of just "HideInInspector"?
    And then add MeshFilter back in Awake? (does DontSave work well on components?)
     
  12. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The Prefab system doesn't currently pay attention to the HideFlags which is why the Mesh Filter still shows up.

    Although the Mesh Filter is not a serialized property in TMP, the Mesh Filter component / inspector does which is why the Prefab system picks it up.

    My suggestion is for the Prefab system to pay attention to these HideFlags as it would provide control over what the Prefab system tracks or doesn't.
     
    OndrejP likes this.
  13. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    And did you report a bug with that that we can vote on? This is a pretty annoying workflow issue with Prefabs but I haven't seen any mention of it being tracked / worked on / acknowledged.