mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 11:32:13 +00:00
Merge pull request #99137 from KoBeWi/uideal_scenario
Handle scene UIDs in MultiplayerSpawner
This commit is contained in:
commit
dd0c24bcd3
@ -97,7 +97,13 @@ PackedStringArray MultiplayerSpawner::get_configuration_warnings() const {
|
|||||||
|
|
||||||
void MultiplayerSpawner::add_spawnable_scene(const String &p_path) {
|
void MultiplayerSpawner::add_spawnable_scene(const String &p_path) {
|
||||||
SpawnableScene sc;
|
SpawnableScene sc;
|
||||||
sc.path = p_path;
|
if (p_path.begins_with("uid://")) {
|
||||||
|
sc.uid = p_path;
|
||||||
|
sc.path = ResourceUID::uid_to_path(p_path);
|
||||||
|
} else {
|
||||||
|
sc.uid = ResourceUID::path_to_uid(p_path);
|
||||||
|
sc.path = p_path;
|
||||||
|
}
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
ERR_FAIL_COND(!ResourceLoader::exists(p_path));
|
ERR_FAIL_COND(!ResourceLoader::exists(p_path));
|
||||||
}
|
}
|
||||||
@ -139,7 +145,7 @@ Vector<String> MultiplayerSpawner::_get_spawnable_scenes() const {
|
|||||||
Vector<String> ss;
|
Vector<String> ss;
|
||||||
ss.resize(spawnable_scenes.size());
|
ss.resize(spawnable_scenes.size());
|
||||||
for (int i = 0; i < ss.size(); i++) {
|
for (int i = 0; i < ss.size(); i++) {
|
||||||
ss.write[i] = spawnable_scenes[i].path;
|
ss.write[i] = spawnable_scenes[i].uid;
|
||||||
}
|
}
|
||||||
return ss;
|
return ss;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
struct SpawnableScene {
|
struct SpawnableScene {
|
||||||
String path;
|
String path;
|
||||||
|
String uid;
|
||||||
Ref<PackedScene> cache;
|
Ref<PackedScene> cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user