Deprecating the Resources API

Posted by Miss 2 years ago


The Resources API will be receiving some breaking changes in the upcoming updates. As a result, you may see some errors in your log that look like this:

[ScriptRuntime] [17:24:37] DEPRECATED: Do not use Resources::GetFont! Use UI::LoadFont or nvg::LoadFont instead!

The following functions and types are being removed:

Resources::Font@ Resources::GetFont();
Resources::Texture@ Resources::GetTexture();
Audio::Sample@ Resources::GetAudioSample();

And the following new functions are added:

UI::Font@ UI::LoadFont();
UI::Texture@ UI::LoadTexture();
nvg::Font nvg::LoadFont();
nvg::Texture@ nvg::LoadTexture();
Audio::Sample@ Audio::LoadSample();

This adds a separation between UI fonts and NanoVG fonts, which should result in faster font loading and less memory usage. Additionally, NanoVG is getting texture support as well through its own API.

There is a (temporary) compatibility layer for the Resources API, to make sure existing plugins can still function. Make sure you update your plugins as soon as you can to keep them from breaking sometime in the future when this compatibility layer gets removed.

This post was written by Miss(Trusted developer)