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
- Errors are logged when importing an asset at a path with Firebase
- Entering too big of a number in 2D Renderer Lightmode Tags freezes the Editor
- Crash on GUIManager::DoGUIEvent when focusing on the Game view window on a specific project
- Asset creation in the Project Browser is not always undone/inconsistent when the undo shortcut is pressed right after creating an asset
- JobTempAlloc memory leak warning is thrown when the Player is shut down
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