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

After Git pull Unity changed materials

Discussion in 'Editor & General Support' started by ExcaliburGames, Apr 14, 2021.

  1. ExcaliburGames

    ExcaliburGames

    Joined:
    Oct 29, 2013
    Posts:
    50
    Hi everyone.
    So I and my teammate using Git.
    We have Win10, the same Unity version and identical Project settings.
    So I'm working and committing changes - all works great. But when my teammate pulls new commits his Unity made changes like this to materials:


    And I'm very confused, why my Unity do not want such changes and his made it?
    Why material need MonoBehaviour settings?

    Will be happy for any suggestions.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    It is always best to close Unity when using source control.

    The above kinda looks like perhaps a custom importer script is doing something to that material.

    To figure out what MonoBehavior is added, search for that
    d0353a89b...
    GUID in all of the .meta files of your project, and that will tell you where it came from. I usually use the Posix
    grep
    utility to do this rapidly, but any text search tool will do.
     
  3. ExcaliburGames

    ExcaliburGames

    Joined:
    Oct 29, 2013
    Posts:
    50
    Hi Kurt-Dekker thanks for good idea.
    Guid: d0353a89b1f911e48b9e16bdc9f2e058 has "AssetVersion.cs" file with name space "UnityEditor.Rendering.Universal" from com.unity.render-pipelines.universal@10.4.0 package.

    Don't know what do to with this information
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
  5. ExcaliburGames

    ExcaliburGames

    Joined:
    Oct 29, 2013
    Posts:
    50
    We are using URP, I can't remove it.

    Do you think it's can be URP bug and I should report it?
     
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    I haven't used URP. Maybe it's how they identify materials they have adjusted? Check your other materials. Did they get modified or is it just one? Make a branch, commit the modification, live with it for a bit. Is it benign? etc. etc.

    Remember even if you report it as a bug, a) it might not be a bug, and b) they may never fix it anyway.
     
  7. ExcaliburGames

    ExcaliburGames

    Joined:
    Oct 29, 2013
    Posts:
    50
    I'm working with Unity since version 4.0 =)))

    I will wait some time, maybe someone will have some other ideas.

    BTW I tested materials with these changes on my side - and all works fine.
     
  8. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    514
    I've just gotten this exact same issue where many materials have the same script with the same GUID added to all materials when importing them for the first time and like your scenario only I was getting this change and not my teammate. What I've realised is that the team mate that first committed a batch of new materials first imported them while using non-URP shaders which is common when importing a third party asset package. He's changed the shaders to URP Lit and then committed them. But what I'm fairly sure is happening is that only when materials that do have a URP shader are imported for the first time only get this hidden AssetVersion script added to them. I have no idea why it's only when they're first imported, this seems like a really sloppy approach and surely will lead to some sort of inconsistent behaviour.

    The AssetVersion script only contains a version number variable, but this does mean that materials changed to URP after import will not contain this hidden meta data and seems to me that it will cause an issue for Unity at some point. It's gotta be semi-important otherwise it would never have been added in the first place.

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. namespace UnityEditor.Rendering.Universal
    4. {
    5.     class AssetVersion : ScriptableObject
    6.     {
    7.         public int version;
    8.     }
    9. }
     
  9. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    514
    For reference I'm using Unity version 2021.1.18 with URP 11.0.0