Direct-rendered UI
In FiveM, you can also render NUI to a runtime texture, which is called DUI for ‘direct NUI’. The following natives help with this:
- CREATE_DUI
- CREATE_RUNTIME_TEXTURE_FROM_DUI_HANDLE
- DESTROY_DUI
- GET_DUI_HANDLE
- IS_DUI_AVAILABLE
- SEND_DUI_MESSAGE
- SEND_DUI_MOUSE_DOWN
- SEND_DUI_MOUSE_MOVE
- SEND_DUI_MOUSE_UP
- SEND_DUI_MOUSE_WHEEL
- SET_DUI_URL
The native documentation contains information for each of these, but here are some creative use cases for this:
- Rendering in 2D space using DRAW_SPRITE
- Rendering to a game render target object using similar natives.
- Rendering arbitrarily in world space using a specialized Scaleform, like in this forum topic.
This can be used to make cinema screens, asynchronous in-game hint overlays, etc. fairly trivially.
Last modified August 31, 2021: fix(nui): update some info (b8e1432)