On my game I have a global camera, as well as the global MTLOD/LodManager. When switching back and forth between scenes, some previously instantiated assets are removed from the tree and get added again. This causes them to stop changing LODs. Neither the LODManager nor the camera have changed or been removed from the tree, only the assets. Though my previous design did remove and add different cameras upon scene changes.
If I specify print("Setting camera: ", LodManager.set_camera(path_to_my_camera)) upon scene loads I get true, and during the first scene load, the LODs change on the assets as without this line. However, upon disconnecting and reconnecting the scene (assets remain instantiated), they stop changing LODs, even though I specify set_camera in _enter_tree() as soon as the scene loads. set_up_camera does the same thing.
Adding and removing objects from the tree is the primary way for levels to be loaded or objects streamed in and out, so they need to register on _enter_tree.
On my game I have a global camera, as well as the global MTLOD/LodManager. When switching back and forth between scenes, some previously instantiated assets are removed from the tree and get added again. This causes them to stop changing LODs. Neither the LODManager nor the camera have changed or been removed from the tree, only the assets. Though my previous design did remove and add different cameras upon scene changes.
If I specify
print("Setting camera: ", LodManager.set_camera(path_to_my_camera))
upon scene loads I get true, and during the first scene load, the LODs change on the assets as without this line. However, upon disconnecting and reconnecting the scene (assets remain instantiated), they stop changing LODs, even though I specify set_camera in _enter_tree() as soon as the scene loads.set_up_camera
does the same thing.It looks like you are registering objects with LodManager in
_ready()
instead of_enter_tree()
, though I think it belongs in the latter or both. https://github.com/puchik/godot-extras/blob/24f8d7471ca3f5a3576abb00a70ba4381558ceed/gdnative/multi-lod/src/lod.cpp#L133Here you are removing their registration as soon as they leave the tree. https://github.com/puchik/godot-extras/blob/24f8d7471ca3f5a3576abb00a70ba4381558ceed/gdnative/multi-lod/src/lod.cpp#L62
Adding and removing objects from the tree is the primary way for levels to be loaded or objects streamed in and out, so they need to register on
_enter_tree
.