Search Issue Tracker

Fixed

Votes

0

Found in

2019.3.8f1

2019.3.10f1

2020.1

2020.2

Issue ID

1240128

Regression

Yes

"Property (_BaseColor) already exists. Use SetTexture instead." thrown with URP SimpleLit material and .mainTexture is called

Graphics - General

-

How to reproduce:
1. Open attached project "Regressions2019.3.10.zip" and scene "SampleScene"
2. In Project window, Reimport 'SetTexture' script
3. In Hierarchy window, select 'GameObject' object
4. In Inspector window, right-click on 'SetTexture' script component -> "Set"
5. Observe Console window

Expected result: texture is assigned to the object material, no warnings are thrown
Actual result: warning in console "Property _BaseColor already exists"

Reproducible with: 2019.3.8f1, 2019.4.1f1 (URP 7.3.1), 2020.1.0b12, 2020.2.0a14
Not reproducible with: 2018.4.23f1 (LWRP 4.10.1) 2019.3.0a1, 2019.3.7f1 (URP 7.3.1)
Could not test with:

Notes:
- No repro on MacOS
- No repro with Universal Render Pipeline/Lit shader
- "Set" error only prints to console once per session (reimport 'SetTexture' script)
- Used DX11 when checking
- a similar error prints every time "Set" is clicked if we add Debug.Log(renderer.sharedMaterial.mainTexture);

  1. Response avatar

    Resolution Note (fix version ):

    A quick manual workaround might be to swap [MainTexture] & [MainColor] in Unlit shader.

    Fixed in URP 9, 8 and 7

Comments (1)

  1. Aa4319491988338a0a568ce7b6582f57?d=mm

    Deutschland1000

    Aug 02, 2020 15:42

    I had the same issue and found out that the problem is that the URP SimpleLit material does not have a "_MainTex" property, so renderer.sharedMaterial.mainTexture is not working. The solution is to use renderer.sharedMaterial.SetTexture("_BaseMap", yourTexture) or renderer.sharedMaterial.GetTexture("_BaseMap") instead.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.