diff --git a/engine/include/cubos/engine/assets/bridges/json.hpp b/engine/include/cubos/engine/assets/bridges/json.hpp index 69397aec6d..be67d97ce3 100644 --- a/engine/include/cubos/engine/assets/bridges/json.hpp +++ b/engine/include/cubos/engine/assets/bridges/json.hpp @@ -46,11 +46,6 @@ namespace cubos::engine // Deserialize the asset and store it in the asset manager. T data{}; deserializer.read(data); - if (deserializer.failed()) - { - CUBOS_ERROR("Could not deserialize asset from JSON file"); - return false; - } assets.store(handle, std::move(data)); return true; @@ -63,16 +58,11 @@ namespace cubos::engine // Read the asset from the asset manager and serialize it to the file stream. auto data = assets.read(handle); - serializer.write(*data, nullptr); // JSON serializer does not use names. - if (serializer.failed()) - { - CUBOS_ERROR("Could not serialize asset to JSON file"); - return false; - } + serializer.write(*data); // new JSONSerializer() does not receive a stream to write to, need to write to it manually auto jsonStr = serializer.output().dump(); - stream.write(jsonStr.begin(), jsonStr.size()); + stream.print(jsonStr); return true; } }; diff --git a/engine/samples/assets/json/main.cpp b/engine/samples/assets/json/main.cpp index 04664d4660..165181af66 100644 --- a/engine/samples/assets/json/main.cpp +++ b/engine/samples/assets/json/main.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include @@ -60,7 +60,7 @@ static void configSystem(Write settings) /// [Register bridge] static void bridgeSystem(Write assets) { - assets->registerBridge(".strings", std::make_unique>()); + assets->registerBridge(".strings", std::make_unique>()); } /// [Register bridge] @@ -89,4 +89,4 @@ int main() cubos.startupSystem(configSystem).tagged("cubos.settings"); cubos.run(); -} +} \ No newline at end of file diff --git a/engine/samples/assets/saving/main.cpp b/engine/samples/assets/saving/main.cpp index 18d5e3b367..e37d3c01e1 100644 --- a/engine/samples/assets/saving/main.cpp +++ b/engine/samples/assets/saving/main.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include @@ -58,7 +58,7 @@ static void configSystem(Write settings) static void bridgeSystem(Write assets) { - assets->registerBridge(".int", std::make_unique>()); + assets->registerBridge(".int", std::make_unique>()); } /// [Create a new asset]