Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

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

Discussion in '2020.2 Beta' started by Peter77, Sep 24, 2020.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,313
    Reimporting a script causes Unity to create new "Hidden/Preview Transparent" materials every time.

    screenshot.png

    Reproduce
    1. Open attached project or create new one
    2. Open Profiler, select Memory tab
    3. Switch to "Detailed" mode
    4. Press "Take sample Editor"
    5. Expand "Scene Memory" and note the Material count
    6. Reimport "Scripts/NewBehaviourScript.cs"
    7. Press "Take sample Editor"
    8. 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.
     
    Last edited: Sep 25, 2020
    mahdi_jeddi and LeonhardP like this.
  2. b4gn0

    b4gn0

    Joined:
    Jul 26, 2019
    Posts:
    119
    Does this also happen when you change a script, or just when doing a manual reimport?
     
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,313
    It happens in both cases.
     
  4. b4gn0

    b4gn0

    Joined:
    Jul 26, 2019
    Posts:
    119
    That is a great find, especially if it's the reason of the hogging that happens when changing scripts!
     
    mahdi_jeddi and Peter77 like this.
unityunity