- Home /
How to cleanly delete Object with attached Bounding Box Rig (Script)?
I created a prefab to create a object that can be moved, resized and turned with the help of this tutorial https://codeholo.com/2018/05/06/move-resize-and-rotate-objects-in-your-hololens-apps/. Therefore in the the prefab I attached the Bounding Box Rig (Script). When I create and instance of the prefab 4 game objects are created:
(1) my actual physical game object that is renamed when renaming the created instance
(2) center
(3) BoundingBoxBasic(Clone)
(4) AppBar(Clone)
When deleting my moveable/scaleable/... objects I would like to remove all the associated game objects. However when doing from a script (what I want to do) I only manage to destroy (1), since I was able to give it an unique name. This means that the app bar associated with the object is still displayed.
Even when the remove buttom of the app bar is used the associated game objects (2) and (3) persists.
After creating and removing multiple objects, or after trying to clean the scene and put in other objects this results in a cluttered Hierachy window or when trying to do it from script in a number of left over app bars. I still but quite some time in trying to solve this issue but so far I could not find a proper way to do it. I am not very experience in Unity programming but doing my best. All help will be appreciated! Thanks!
Your answer
Follow this Question
Related Questions
NullReferenceException - When destroying Object 1 Answer
Deleting one object, not all objects at once. 1 Answer
if object is destroyed 2 Answers
Distribute terrain in zones 3 Answers