Search Issue Tracker
Won't Fix
Votes
0
Found in
2019.4
2020.3
2020.3.0f1
2021.1
2021.2
Issue ID
1326869
Regression
No
[macOS] "Metal: cannot write to unused constant buffer." error is thrown when using UnityEngine.GL inside OnSceneGUI
How to reproduce:
1. Open the attached project's "case_1326869-Project.zip" Scene labeled "Test"
2. In the Hierarchy, select the "Test" GameObject
3. In the Inspector, enter "8" under "Vertices Num" field
4. Click the "Init" button
5. Move the mouse over the Scene View
Expected result: No errors or warnings are thrown and a line is drawn
Actual result: Nothing is drawn and a "Metal: cannot write to unused constant buffer." error and "Metal: Vertex shader missing buffer binding at index 0" warning is thrown
Reproducible with: 2019.4.24f1, 2020.3.3f1, 2021.1.2f1, 2021.2.0a12
Couldn't test with: 2018.4.34f1 (Package dependencies break the project)
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
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
- Adaptive Probe Volume occlusion edge is calculated incorrectly when viewing probes near geometry edges
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
Resolution Note (2021.2.X):
There is an error in the usage of GL class. As material is never set up, unity uses the last shader set, which, in case of scene view rendering, would be some builtin blit shader. The solution would be to setup the material, e.g.
private void OnSceneGUI()
{
if(mat == null)
{
Shader shader = Shader.Find("Hidden/Internal-Colored");
mat = new Material(shader);
mat.hideFlags = HideFlags.HideAndDontSave;
}
mat.SetPass(0);
<...>
i copied this directly from https://docs.unity3d.com/ScriptReference/Material.SetPass.html