(Case 1280162) "Hidden/Preview Transparent" material leak

Reimporting a script causes Unity to create new “Hidden/Preview Transparent” materials every time.

Reproduce

  • Open attached project or create new one

  • Open Profiler, select Memory tab

  • Switch to “Detailed” mode

  • Press “Take sample Editor”

  • Expand “Scene Memory” and note the Material count

  • Reimport “Scripts/NewBehaviourScript.cs”

  • Press “Take sample Editor”

  • Goto step 4

Actual
Every script reimport new materials are being created, more precisely new copies of the “Hidden/Preview Transparent” material.

Expected
No material leak.

2 Likes

Does this also happen when you change a script, or just when doing a manual reimport?

It happens in both cases.

That is a great find, especially if it’s the reason of the hogging that happens when changing scripts!

2 Likes