deleted/change C# code reverts in Visual Studio

I’m sure this is an understood situation that I’m new to.

I updated to 2020.1 and want to get rid of some code in a script I otherwise shouldn’t be meddling with - TMPro_Private.cs

I delete the Debug statement that says this, “Removing unnecessary CanvasRenderer component from text object.”

But when I play in unity, the deleted code literally returns in Visual Studio.

One clue? – In visual studio, I ‘moved’ it into “Assembly-CSharp” and now dozens of functions and variables have the red jagged line under them, even though it I get no errors in the console, and the game runs fine.

It’s an internal thing. You really shouldn’t ever have the need to mess with that?

Why would you want to remove that debug statement?

I’ve updated to 2020.1 and TMPro package to 3.0 but this debug statement floods my console every time I enter a level. And I can’t remove CanvasRenderer from my GameObjects.

same here. I’m instantiating a prefab that contians a TMP object and I get this message:

Removing unnecessary CanvasRenderer component from text object.
UnityEngine.Debug:Log(Object, Object)
TMPro.TextMeshPro:Awake() (at Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMPro_Private.cs:77)
UnityEngine.Object:Instantiate(GameObject)

followed by an error:

Destroying components immediately is not permitted during physics trigger/contact, animation event callbacks, rendering callbacks or OnValidate. You must use Destroy instead.
UnityEngine.Object:smile:estroyImmediate(Object)
TMPro.TextMeshPro:Awake() (at Library/PackageCache/com.unity.textmeshpro@3.0.1/Scripts/Runtime/TMPro_Private.cs:78)
UnityEngine.Object:Instantiate(GameObject)
ResourceLoader:spawn(String) (at Assets/Scripts/ResourceLoader.cs:53)
DialogPanel:addDialogBubble(String, String, Transform, Boolean) (at Assets/Scripts/DialogPanel.cs:161)
WebTrap:OnTriggerEnter(Collider) (at Assets/Scripts/WebTrap.cs:23)

I get this too, after updating unity. Prefabs with TMPro elements have a parent ‘canvas renderer’ object inside them, that isn’t necessary in my case (because it’s the type of TMPro object that renders in the game world, not inside the UI canvas).

I got rid of it by fiddling around a bit with the assets, I’m not sure how but after instancing/deleting the assets and clicking around some more, the canvas renderer parent object disappeared, as well as the debug messages. Hope you get this to work too…