Allocate the selected navigation srevers.

This commit is contained in:
Relintai 2023-04-16 18:20:15 +02:00
parent 86bdecbfe9
commit aabd293f3b

View File

@ -221,14 +221,31 @@ void finalize_physics() {
void initialize_navigation_server() {
ERR_FAIL_COND(navigation_server != nullptr);
navigation_server = NavigationServerManager::new_default_server();
navigation_2d_server = Navigation2DServerManager::new_default_server();
ERR_FAIL_COND(navigation_2d_server != nullptr);
/// 3D Navigation Server
navigation_server = NavigationServerManager::new_server(ProjectSettings::get_singleton()->get(NavigationServerManager::setting_property_name));
if (!navigation_server) {
// Navigation server not found, Use the default physics
navigation_server = NavigationServerManager::new_default_server();
}
ERR_FAIL_COND(!navigation_server);
//physics_server->init();
/// 2D Navigation server
navigation_2d_server = Navigation2DServerManager::new_server(ProjectSettings::get_singleton()->get(Navigation2DServerManager::setting_property_name));
if (!navigation_2d_server) {
// Navigation server not found, Use the default physics
navigation_2d_server = Navigation2DServerManager::new_default_server();
}
ERR_FAIL_COND(!navigation_2d_server);
//navigation_2d_server->init();
}
void finalize_navigation_server() {
memdelete(navigation_server);
navigation_server = nullptr;
memdelete(navigation_2d_server);
navigation_2d_server = nullptr;
}