⚠️ This site is under development, some artefacts may be missing or incomplete.
PIXEL UI
Getting Started

Getting Started

Developing an addon which depends on PIXEL UI requires a few steps to be taken before you can start coding.

Installation

PIXEL UI must be installed within the environment that your addon is being used, it can be downloaded from the GitHub releases page here (opens in a new tab). To install the library, the release archive must be extracted into the garrysmod/addons folder. The folder structure should look similar to this:

💡

The addon folder name must not contain capital letters on Linux servers and will fail to load if it does.

Loading after PIXEL UI

To ensure your addon does not reference PIXEL UI before it has been loaded, you are required to implement the PIXEL.UI.FullyLoaded hook. The following example demonstrates how this can be achieved:

lua/autorun/load_my_addon.lua
local function loadAddon()
	print("Loading my addon")
	PIXEL.LoadDirectoryRecursive("my_addon")
end
 
if PIXEL and PIXEL.UI then
	loadAddon()
	return
end
 
hook.Add("PIXEL.UI.FullyLoaded", "MyAddon.WaitForPIXELUI", loadAddon)
ℹ️

Ensure that the identifier of your addon's loader hook is unique, conflicts are likely to occur otherwise.