Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2018.4.29f1
2021.1
Issue ID
1291755
Regression
No
ShaderUtil.CreateShader with invalid source causes Shader interactions to throw a warning/error until the Editor is restarted
How to reproduce:
1. Open the user's attached "New Unity Project (11).zip" project
2. Go to Testing -> Create Shader
3. Right-click on the "NewSurfaceShader" Asset in the Project window
4. Press the "Reimport" menu item
5. Observe the Console log
Expected result: No errors messages are thrown in the Console log
Actual result: "Shader error in '': Parse error: syntax error, unexpected $undefined, expecting TOK_SHADER at line 1" error message is thrown in the Console log
Reproducible with: 2018.4.29f1, 2019.4.14f1, 2020.1.13f1, 2020.2.0b11, 2021.1.0a5
Notes:
- The issue is also reproducible when creating a new Image Effect Shader, Unlit Shader, Standard Surface Shader
- The issue is not reproducible when creating a new Compute Shader, pressing "Refresh" on a specific Shader, or compiling a Shader's code
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
- The tag adder functionality does not work if a space is entered instead of a name
- Errors thrown in the Console when configuring In-App Purchases package
- Longer Scaler Profile names go out of the"Scaler Profilers" section
- AI Navigation window UI elements overlap when the AI Navigation window is docked and resized
- Editor freezes after some time when using NavMeshQuery::Raycast
Resolution Note (2021.1.X):
ShaderUtil.CreateShaderAsset() will create a shader object that, unless explicitly destroyed, will live in the editor session until the editor is shut down. Whenever some shaders are importer we atm reload all the shaders and log any existing errors in them. Now, the created shader had an error in it so it will appear in the console after any shader being imported. This all is expected although a bit awkward in this synthetic case where the shader is created without import context which makes the error message to be not so informative.