diff --git a/API/oursin/renderer.py b/API/oursin/renderer.py index 99dec083..a068bbeb 100644 --- a/API/oursin/renderer.py +++ b/API/oursin/renderer.py @@ -76,4 +76,9 @@ def clear_volumes(): def clear_texts(): """Clear all text """ - client.sio.emit('Clear', 'texts') \ No newline at end of file + client.sio.emit('Clear', 'texts') + +def clear_primitives(): + """Clear all primitives + """ + client.sio.emit('Clear','primitives') \ No newline at end of file diff --git a/UnityClient/Assets/Scripts/Client.cs b/UnityClient/Assets/Scripts/Client.cs index a2136445..1db9911c 100644 --- a/UnityClient/Assets/Scripts/Client.cs +++ b/UnityClient/Assets/Scripts/Client.cs @@ -226,6 +226,9 @@ private void Clear(string val) case "texts": _textManager.Clear(); break; + case "primitives": + _primitiveMeshManager.Clear(); + break; } } diff --git a/UnityClient/Assets/Scripts/Managers/PrimitiveMeshManager.cs b/UnityClient/Assets/Scripts/Managers/PrimitiveMeshManager.cs index 184ac030..ad70c232 100644 --- a/UnityClient/Assets/Scripts/Managers/PrimitiveMeshManager.cs +++ b/UnityClient/Assets/Scripts/Managers/PrimitiveMeshManager.cs @@ -43,6 +43,15 @@ private void Awake() } } + public void Clear() + { + foreach (var kvp in _primMeshRenderers) + { + Destroy(kvp.Value.gameObject); + } + _primMeshRenderers.Clear(); + } + public void DeleteMesh(List meshes) { foreach (string mesh in meshes)