Seems like the newly added Labels doesn’t handle go.delete very well.
When creating several gameobjects with labels and dynamically set text on them and then delete them, all labels seems to freak out and pick random strings from memory
Below is a test where I create an array of gameobjects, each with a label on them.
Each label is then set to their own text (number in this case).
When deleting one gameobject / second all the other labels goes havoc.
Main script:
function init(self)
self.timer = 1
self.tbl = {}
for i = 1,10 do
for ii = 1,10 do
table.insert(self.tbl, factory.create("#factory", vmath.vector3(ii30,i30,0),nil, {nr = (ii-1)*10+i-1}))
end
end
for i,v in ipairs(self.tbl) do
local url = msg.url(v)
url.fragment = "label"
label.set_text(url, tostring(i))
end
end
function update(self, dt)
self.timer = self.timer - dt
if self.timer < 0 then
local t = table.remove(self.tbl)
go.delete(t)
self.timer = 1
end
end
(no script on gameobject)
Results: