Search Issue Tracker
Fixed in 2017.1.0f3
Votes
0
Found in
5.6.0f3
Issue ID
898067
Regression
Yes
Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' faulty replacement breaking shader
Steps reproduce:
1. Open attached project
2. Open ShadowMeta.cginc
3. Replace UnityObjectToClipPos(pos4) to mul(UNITY_MATRIX_MVP, pos4)
4. Save script
5. Notice that mul(UNITY_MATRIX_MVP, pos4) is upgraded to UnityObjectToClipPos(pos4)
Expected result: mul(UNITY_MATRIX_MVP, pos4) should not be replaced with UnityObjectToClipPos(pos4)
Reproduced in: 2017.1.0a6, 5.6.0f3, 5.6.0f2
Not reproduced in: 5.6.0f1, 5.6.0b11, 5.6.0b1 ,5.6.0a1, 5.5.3f1
Regression since: 5.6.0f2
Comments (16)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [Android] Texture Compression default texture format is set to PVRTC when building via script BuildPipeline.BuildPlayer
- [Android][GameActivity] APK built with Development Build enabled gets flagged as having Malware
- Default name of manually created Global Light 2D GameObject differs from the one included in the initial project Scene
- Option for "Acceleration Structure Build Flags" cannot be toggled when Lightmaps have been Generated for a Mesh Renderer
- Lights in Batch keep resetting to 0 in the Light Batching Debugger when a new GameObject is created and the mouse cursor is hovered over the Inspector window
lshinamashiro_unity
May 23, 2018 07:18
#define UNITY_SHADER_NO_UPGRADE 1
that is a grate idea
cfazilleau
Apr 06, 2018 14:36
marked fixed but broken again on 2017.3.1f1
I fixed it by placing
#define UNITY_SHADER_NO_UPGRADE 1
at the beginning of the shader.
It prevents unity from fixing the shader because you are the dev, so you are the one who fix the bugs
rtilton1
Dec 14, 2017 05:57
Also seeing this issue in 2017.2
andybak
Nov 20, 2017 12:58
Still broken in 2017.2
Try opening this: https://github.com/mattatz/unity-photo-particle-system
and look at the error for either the billboard or butterfly shaders.
toddw
Sep 11, 2017 18:20
There's a better way to fix this than SK_AVARITIA's suggestion. Simply replace all lines that were converted to this:
o.position = UnityObjectToClipPos(v.position);
with this:
o.position = UnityObjectToClipPos(float4(v.position.xyz, 1.0));
The compiler won't attempt to replace it again and it works fine for me.
pigshape
Jun 23, 2017 11:33
@SK_AVARITIA
It worked great for me!!Thanks!
sk_avaritia
Jun 16, 2017 20:00
I used "UNITY_VERSION" and "UNITY_SHADER_NO_UPGRADE" then my code worked.
I hope that I will be helpful for everyone.
[before]
o.vertex = UnityObjectToClipPos(v.vertex);
[after]
#if UNITY_VERSION >= 560
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
#else
#if UNITY_SHADER_NO_UPGRADE
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
#endif
#endif
nefelia
Jun 10, 2017 20:16
are you kidding me!
watermy
Jun 08, 2017 06:45
5.6.1p2 is still broken.
Anyone has a workaround ?
pigshape
Jun 02, 2017 05:21
what means "Fix in review"?.Already fixed? it seems to not be fixed in 5.6.1f1.