Search Unity

Property (_BaseMap) already exists. Use SetTexture instead

Discussion in 'Universal Render Pipeline' started by Brady, Jan 30, 2020.

  1. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    I reworked one of my shaders to work with URP and now, for some reason I can't figure out, every time any shader recompiles, I'm getting the following error:

    "Property (_BaseMap) already exists. Use SetTexture instead"

    I've scoured the shader and its #includes and can't find any additional mentions of _BaseMap except for the one line in com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl, which doesn't seem to be something that should be causing this error. I actually have no idea what this error is trying to say. Does anyone have any light to shed on this? Thanks!
     
  2. Deleted User

    Deleted User

    Guest

    Hi!

    Did you got any solution?
    I have the same problem with the (_MainTex), but should be the same source :)

    Thanks,
    Regards, Matthias
     
  3. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Unfortunately, no. It still does it every time a shader recompiles. It's really annoying. Doesn't seem to be causing any problems that I can tell, but it still bothers me.
     
  4. Careviolan

    Careviolan

    Joined:
    Apr 28, 2017
    Posts:
    1
    Same problem. I think the reason why its happening is we using custom material to render UI
     
  5. L42yB

    L42yB

    Joined:
    Dec 20, 2012
    Posts:
    34
    I have the same error

    Property (_MainTex) already exists. Use SetTexture instead.
    (Filename: C:\buildslave\unity\build\Runtime/Shaders/ShaderPropertySheet.cpp Line: 508)

    Comes up every time I start the editor, but the error has no more information so I have no idea what's causing it.
     
  6. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    365
    It's haunting me as well.
    I am having 4 occurrences with no indication of where it's coming from.
    Anyone figure this out yet?
    I think it's something to do with the new SRP, but I am using the standard pipeline, so I am not sure why I am seeing it.
     
  7. shaojingliu

    shaojingliu

    Joined:
    Mar 20, 2020
    Posts:
    6
    Same problem
     
  8. nooxouille

    nooxouille

    Joined:
    Aug 29, 2018
    Posts:
    24
    Hi there!

    The problem is the same, went trying to create a scrolling background (URP 7.3.1 and Unity 2019.4.13f1).
    The background ain't scrolling and the errors are fired.
    BUT, using 2020.1.17f1 and URP 8.3.1, the background scrolling is working, and there are no errors :/


    Material doesn't have a texture property '_BaseColor'
    UnityEngine.Material:get_mainTextureOffset()



    Material doesn't have a texture property '_BaseColor'
    UnityEngine.Material:set_mainTextureOffset(Vector2)



    Property (_BaseColor) already exists. Use SetTexture instead.
    UnityEngine.Material:set_mainTextureOffset(Vector2)


    [EDIT]
    It's definitely an URP issue for me. Updating to 7.5.1 to see if the issue remain.

    [EDIT2] Problem has been fixed with the update to 7.5.1
     
    Last edited: Jan 25, 2021
  9. CianNoonan

    CianNoonan

    Joined:
    May 19, 2017
    Posts:
    139
    I have the same issue, URP 10.2
     
  10. photonic

    photonic

    Joined:
    Dec 29, 2012
    Posts:
    47
    Having 4 occurrences, as well ...no clue as for the cause 2019.4 LTE, built-in RP
     
    Last edited: Apr 15, 2021
  11. HugeWill

    HugeWill

    Joined:
    Nov 4, 2016
    Posts:
    27
    Using Unity 2020.3 and also having this issue. There's no stack showing which files are the cause of the error.
     
  12. ethiffeault_ubi

    ethiffeault_ubi

    Joined:
    Jan 8, 2019
    Posts:
    2
    same here , 2019.4.13
     
  13. RyanKeable

    RyanKeable

    Joined:
    Oct 16, 2013
    Posts:
    62
    What GUI are you all using for your shaders?

    The LitShader.GUI references _BaseMap and these errors look like GUI errors to me
     
  14. photonic

    photonic

    Joined:
    Dec 29, 2012
    Posts:
    47
    I'm using uGui with DoozyUI
     
  15. RyanKeable

    RyanKeable

    Joined:
    Oct 16, 2013
    Posts:
    62
    does that script make reference to _BaseMap ?
     
  16. HugeWill

    HugeWill

    Joined:
    Nov 4, 2016
    Posts:
    27
    Does anyone have a solution for finding out what shader has caused this error?
     
  17. KSzczech

    KSzczech

    Joined:
    Sep 24, 2020
    Posts:
    30
    I had the same error message when working with custom shader.
    The thing is - my shader did not have _MainTex and yet, that was what eror message was telling me.
    I had 4 textures and every time I tried to set these textures in material, I was getting this error with call stack pointing to my Material.SetTexture call - always on my last, 4th texture.

    My shader and all my parameters and textures were valid.

    What was invalid is the moment I called them - from inside of OnDrawGizmos callback.

    Moving the code out of GUI callbacks solved the issue for me.


    I hope this info will help if anyone else stumbles upon this error and has the same issue :) I guess I got punished for being a lazy bastard who took a shortcut and abused GUI callback ;)
     
  18. IndyNarf

    IndyNarf

    Joined:
    Sep 8, 2015
    Posts:
    7
    I has the same error while starting the editor and in a shader using this property (_DetailsMap for me) I was declaring it twice in the Properties.
    Removing the extra declaration fixed it for me.
     
    forestrf likes this.
  19. pjbaron

    pjbaron

    Joined:
    Jan 12, 2017
    Posts:
    53
    @IndyNarf That sounds like it's worth checking, but I'm working on a project with hundreds of shaders - did you find a way to locate shaders with a duplicate property declaration? I don't fancy going through them one at a time looking for dupes!
     
    eggsamurai, raofr_msn and Graf-enters like this.
  20. eggsamurai

    eggsamurai

    Joined:
    Oct 10, 2015
    Posts:
    114
  21. pjbaron

    pjbaron

    Joined:
    Jan 12, 2017
    Posts:
    53
    @eggsamurai I don't know if this will help and I can't remember the exact resolution on that project, but I did work out how to narrow it down reasonably efficiently: good old fashioned binary search!

    I grouped materials by the shaders used, ignored all the ones using standard shaders, then block selected huge chunks and swapped the shaders for a standard shader regardless of the damage it did to the graphics. Regardless of 'fix' or 'no fix' I had now reduced the search by approx 50% and could undo & repeat until I find the culprit(s).
     
    eggsamurai likes this.
  22. zephybite0

    zephybite0

    Joined:
    Apr 25, 2018
    Posts:
    29
    Have this problem with the default sprite shader.

    EDIT: Nvm figured it out. A different shader in the scene had declared duplicate _MainTex properties
     
  23. x4000

    x4000

    Joined:
    Mar 17, 2010
    Posts:
    353
    Hovl/Particles/Explosion V2 has this error in it, if anyone is using that. In general it's just look for the duplicate until you find it.
     
    yuyuyu61 likes this.