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
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
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