Skip to content

global.autoUnload

JoeStrout edited this page Oct 18, 2026 · 3 revisions

Flag a raylib resource to be unloaded automatically when no longer referenced; returns the resource

Parameters

Parameter Default Value Note
resource

Return value

Condition Return Value
(always) number

Notes

autoUnload r marks resource r to be automatically unloaded shortly after all references to it go out of scope. This only works for certain resource types: currently Image, Texture, Font, Wave, Music, Sound, AudioStream, RenderTexture, and Shader. Mesh, Material, Model, etc. pass themselves around as arguments and create extra internal references inside Raylib that we can't easily track, so for now, those are not supported by autoUnload. Unsupported arguments will return an error value. You can always manually unload a resource (even if you've called autoUnload on it).

Clone this wiki locally