Open wearplugins opened 2 months ago
Hi! After tile removing from the batch instance data buffer you need also call the Upload method to upload CPU copy of the data to the GPU side.
[ExecuteInEditMode]
public class BatchRenderer : MonoBehaviour
/// <summary> </summary>
public void Update()
{
_containers.ForEach(c => c.Update());
}
/// <summary> </summary>
public void Update()
{
if (_initialized)
_batchHandle.Upload();
}
As an experiment
public void Remove(int nodeIndex) { var dataBuffer = _batchHandle.AsInstanceDataBuffer(); dataBuffer.Remove(nodeIndex, 1); _batchHandle.Upload(); }
Doesn't work either.
When the map is reloaded, all containers are rebuilt. Restarting the editor and the computer does not help. It seems that the buffer is cached somewhere.
In the editor, the tile id is set and stored in the map file. I don't delete tiles in вuild. The map is simply loaded and tiles with ID 0 are ignored (I checked) and should not be visible. But they are.
Hmmm, what does the Frame Debugger show? And you can try to use RenderDoc to check the instance buffer data on the GPU.
Ok I will try to find the reason. When I find it, I will describe it and close the issue.
Some strange things happen. I set the data to the map editor (tile id 0) and delete the data from the BatchHandle.
But the data is not deleted and the tile does not disappear. After that the map is saved and reloading. The tiles are back in place and there are no deleted ones.
After assembling the build, the same thing happens, all deleted tiles are displayed.
What do you think could be the problem?