Hi,
I’m following the Magic Ink tutorial on the Defold website. However, I’ve made it to the point where the magic effects are spawned and parented to the block object, and I’ve run into a problem. Checking the effect’s parent immediately after parenting them gives a nil value, which means the following code also doesn’t work as intended.
Here’s my code:
self.fx1 = factory.create("#fxfactory", nil, nil, { direction = hash("left") })
self.fx2 = factory.create("#fxfactory", nil, nil, { direction = hash("right") })
msg.post(self.fx1, "set_parent", { parent_id = go.get_id() })
msg.post(self.fx2, "set_parent", { parent_id = go.get_id() })
print(go.get_parent(self.fx1)) -- Returns nil
go.set(self.fx1, "position.z", 0.01)
go.set(self.fx1, "scale", 1)
go.set(self.fx2, "position.z", 0.02)
go.set(self.fx1, "scale", 1)