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

Disabling 3D physics with TextMesh Pro

Discussion in 'Package Manager' started by Gamrek, Jul 15, 2018.

  1. Gamrek

    Gamrek

    Joined:
    Sep 28, 2010
    Posts:
    164
    Hello,

    In 2018.2 there is a feature that we can disable built In Packages that we don't use in project to reduce the build size. I want to disable 3D physics as I am currently making a 2D game, but when i disable it it gives me a warning saying TextMesh Pro is depended on it since it uses "Collider" in the script.

    Is there any way to work around that? I really don't want to include 3D physics but want to keep Textmesh pro.

    Thanks.
     
    andrzej_cadp likes this.
  2. Nimbuster

    Nimbuster

    Joined:
    Mar 28, 2015
    Posts:
    1
    I have the same request. The official solution would probably be to wait for a newer version of TextMesh Pro, but the hack I did was wrap the Collider-dependent code in TMP_SubMesh with
    #if PHYSICS3D
    , such as the boxCollider field and the UpdateColliders() function. The PHYSICS3D symbol does not exist, but you can manually add it Player > Other Settings when you need the Physics package.
     
  3. andrzej_cadp

    andrzej_cadp

    Joined:
    Jan 27, 2017
    Posts:
    18
    I support this request with all of my heart.
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I'll remove the reference to the BoxCollider as this was part of some experimental stuff to automatically add colliders to each character for some physics fun.

    This change will be in the next release of the TMP UPM package.

    Until then, and sort as @Nimbuster stated, you can actually comment out the relevant properties that reference the BoxCollider as well as the function UpdateColliders() in the TMP_SubMesh.cs script.

    P.S. Since TMP has a dependency on the UI system which in turn has a dependency on Physics for Raycasting, some parts of the physics stuff might still get included. As I have stated before, I would like to remove this dependency for the normal <TextMeshPro> component. Since the <TextMeshProUGUI> component works with the UI system, it will still have this dependency.