Search Issue Tracker

Won't Fix

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

  1. 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

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.