atsmith6 Posted June 29, 2017 Posted June 29, 2017 Hi all A quick question about group ID's and group spawning in case somebody can help. I've noticed that if I create a group with some name like "MyCoolGroup" and spawn it with coalition.addGroup(...) then I get a nice shiny new group. Then to remove it I can use Group.getByName('MyCoolGroup'):destroy() and as expected the shiny new unit goes away. However, if I try and create a new unit with the same name then nothing happens. This implies to me that the group was never actually got rid of. It's still in the sim somewhere. To my mind this equates to a resource leak which I really don't want to do. So now to my question: Is there a way to properly remove the group so that if I'm creating and removing many of them I am not leaking and slowly degrading the sim's performance? For context I have considered activating and deactivating units but unit re-use isn't really a good option for what I have in mind. If anyone can offer any help I will be hugely grateful. Kind Regards A
sunski34 Posted June 30, 2017 Posted June 30, 2017 Hi, I had problems with destroy function of Group class when writing my framework script ATME. A solution may be the use of destroy function of Unit class, so for a group you have to create a loop. That works... Hope that help.
atsmith6 Posted July 1, 2017 Author Posted July 1, 2017 Hi, I had problems with destroy function of Group class when writing my framework script ATME. A solution may be the use of destroy function of Unit class, so for a group you have to create a loop. That works... Hope that help. Thank you. You may have just saved me a few hours of debugging!
Recommended Posts