Closed tristanbob closed 3 years ago
The issue seems to be coming from the fact that runtimeScene.getObjects
return always the latest objects list including the newly created objects, while eventsFunctionContext.getObjects
returns the objects from when the events function was called, before creating the objects. Not sure if it is intended behavior or not.
The issue seems to be coming from the fact that
runtimeScene.getObjects
return always the latest objects list including the newly created objects, whileeventsFunctionContext.getObjects
returns the objects from when the events function was called, before creating the objects. Not sure if it is intended behavior or not.
Correct. I think we should:
eventsFunctionContext.getObjects
. I'm not even sure it's that useful. EDIT: actually let's keep it, we can update the array in the createObject too.Thanks for fixing this so fast, guys! This was holding me back to finish this object chain extension. :)
I can confirm that the nightly build has this fix and it works as expected.
Describe the bug
ForEach() does not include objects that were created the same frame (when using an Extension function)
To Reproduce
See project file. Includes a test using normal events (no problems) and a test using an extension function (causes problem).
Live Game
https://games.gdevelop-app.com/game-959d24dc-50bd-4d65-9fdd-47e0acee60c4/index.html
Project files
ChainOfObjects-BugTest.zip
Video
https://user-images.githubusercontent.com/8879811/110252697-e6675480-7f43-11eb-88da-0014d8e1c1e8.mp4