I'm experiencing very odd loading/unloading behavior as I leave an area. Here's my setup, I created a simple test block with the following script: Code: function init() sb.logInfo("INIT"); end function uninit() sb.logInfo("UNINIT"); end I then place the test block in the world with no other objects around it : As I walk away from the object, I get this output : Code: [11:58:29.506] [Info] INIT [11:59:39.571] [Info] UNINIT It unloads as normal when I leave the area, which is the expected output. But now, if I place a Copper Box nearby like so: As I walk away, I get a very different output: Code: [11:58:29.506] [Info] INIT [11:59:39.571] [Info] UNINIT [12:04:07.605] [Info] INIT [12:06:52.064] [Info] UNINIT [12:06:52.121] [Info] INIT [12:07:02.140] [Info] UNINIT [12:07:02.195] [Info] INIT [12:07:11.179] [Info] UNINIT [12:07:11.231] [Info] INIT [12:07:21.941] [Info] UNINIT [12:07:21.998] [Info] INIT [12:07:31.914] [Info] UNINIT [12:07:31.966] [Info] INIT [12:07:41.507] [Info] UNINIT [12:07:41.566] [Info] INIT [12:07:50.650] [Info] UNINIT [12:07:50.701] [Info] INIT [12:08:00.800] [Info] UNINIT [12:08:00.855] [Info] INIT [12:08:10.260] [Info] UNINIT [12:08:10.313] [Info] INIT [12:08:19.851] [Info] UNINIT [12:08:19.905] [Info] INIT [12:08:29.313] [Info] UNINIT [12:08:29.414] [Info] INIT [12:08:39.926] [Info] UNINIT [12:08:39.979] [Info] INIT [12:08:49.322] [Info] UNINIT [12:08:49.372] [Info] INIT [12:08:59.846] [Info] UNINIT [12:08:59.902] [Info] INIT ... So it's loading and unloading the object in a loop forever! This odd behavior is causing objects in my mod to do things incorrectly. Is this a bug or is it something else I'm not aware of?
Maybe it was just you moving in an area that's really on the threshold of where that object might load/unload. Because they're in different chunks. You can set a variable at the end of init which tells you init has ran already and put most/all your init function in an if statement to prevent running unneeded code again.