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
- Opening Terrain Prefab in Prefab Editing Mode throws "NullReferenceException" error
- [Search] Dragging query pills put them behind the search text field
- A CustomPropertyDrawer that returns a PropertyField for a property named the same as a child field will not render all child fields
- Graphics Settings shows default values instead of the real values in the Rendering Debugger when Volume.profile is assigned via script
- Deleting multiple Tags throws “NullReferenceException”, and "Retrieving array element that was out of bounds" errors when holding the Enter key
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