OBJECT SPAWNER 2D ERROR HELP!
Hey Guys,
I am getting this error with the object spawner 2d from the templates.
The objects behave as I want, but after a while, some objects freeze their position and this message appears in the log. Does anyone have an idea of what it means?
[Scenarium] Error: Argument 0: Value is not a native object
at [anon] () native strict preventsyield
at spawn (Object Spawner 2D Resources/Scripts/ObjectSpawner2D.js:257)
at onUpdate (Object Spawner 2D Resources/Scripts/ObjectSpawner2D.js:224) preventsyield
nice
Replace line 251 with this:
var randomIndex = Math.floor(Math.random() * originalObjects.length);
This is an error from whoever developed this, Math.random() can return 0 and they subtracted 0.0001 from that which gives a negative number, which cant be used as an array index, if it happens to land on 0.
Such a small chance it lands at 0 or close enough to cause this in this case so im surprised you actually found this lol.
Thanks so much for this, it worked like a charm :D
Hey Brandon / Apoc,
Thanks for finding the cause and sharing with the community. We have updated the files in the asset library.
Cheers,
Vincent