Search Issue Tracker
Won't Fix
Won't Fix in 2023.1.X
Votes
0
Found in
2020.3.23f1
2023.1.0a5
Issue ID
UUM-12007
Regression
No
[Mesh] Cylinder and Sphere meshes disappear until editor restart after modifying index buffer in playmode
Steps
- Open project (see comments)
- Open Assets/LOW/BreaksResourcesRepro
- Check scene view
## Observe that Cylinders and spheres are visible
- Enter playmode
- Exit playmode
- Check scene view
{}Expected{}: Cylinders and Spheres are still visible
{}Actual{}: Cylinders and Spheres are no longer visibile
Repro: 2020.3.23f1, 2023.1.0a5
{}Notes{}:
- fixed after editor restart
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
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
- AI Assistant breaks compilation of packages using System.Runtime.CompilerServices.Unsafe via auto-referencing
- Unity Hub checks the "Documentation" module by default on the 6.4 and 6.5 streams despite that it was unchecked with the previous installs
- Shortcut that toggles between Dopesheet and Curves Views in the Animation Window's Timeline is mislabed
- Property List Items Overlap onto the Property List's top edge when scrolling through a long Property List
Resolution Note:
The code changes the index buffer format on built-in resources. As described in documentation this clears the index buffer and resets submesh count to 1. This persists even outside of playmode because the GPU data was cleared. Between entering and exiting playmode the GPU data is not re-uploaded. This would put a big burden on entering playmode. Restarting the editor fixes the problem as the meshes are loaded from disk again and the buffers are uploaded to GPU.
In this case I'd advice creating a copy of the original and modify that as desired. Or you need to restore the things that are cleared by changing the index format (set the submeshes up again and fill the index buffer). Note that also in a similar way you could change the vertex positions inside the buffer on the GPU. Those changes will persist across playmode too.
related documentation:
https://docs.unity3d.com/ScriptReference/Rendering.IndexFormat.html
https://docs.unity3d.com/ScriptReference/MeshFilter-sharedMesh.html
https://docs.unity3d.com/ScriptReference/MeshFilter-mesh.html
Resolution Note (2023.1.X):
The code changes the index buffer format on built-in resources. As described in documentation this clears the index buffer and resets submesh count to 1. This persists even outside of playmode because the GPU data was cleared. Between entering and exiting playmode the GPU data is not re-uploaded. This would put a big burden on entering playmode. Restarting the editor fixes the problem as the meshes are loaded from disk again and the buffers are uploaded to GPU.
In this case I'd advice creating a copy of the original and modify that as desired. Or you need to restore the things that are cleared by changing the index format (set the submeshes up again and fill the index buffer). Note that also in a similar way you could change the vertex positions inside the buffer on the GPU. Those changes will persist across playmode too.
related documentation:
https://docs.unity3d.com/ScriptReference/Rendering.IndexFormat.html
https://docs.unity3d.com/ScriptReference/MeshFilter-sharedMesh.html
https://docs.unity3d.com/ScriptReference/MeshFilter-mesh.html