I have a script that spawns a star with the following function:
function spawn_star()
local position = go.get_position()
position.x = sys.get_config("display.width")
position.y = math.random(60, 600)
if math.random() < 0.05 then
factory.create("#booster_factory", position)
end
end
This works for the most part but sometimes it throws the error “Component could not be found”. I have not found a pattern for when it throws the error but it seems to be random.
The really interesting thing is that the problem disappears if I specify the parent object in the path. This example is working as expected:
function spawn_star()
local position = go.get_position()
position.x = sys.get_config("display.width")
position.y = math.random(60, 600)
if math.random() < 0.05 then
factory.create("factories#booster_factory", position)
end
end
Is there something that I am missing that causes this or is it some kind of bug? It is maybe a known issue?
Thanks!