Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions lua/modules/uikit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,12 @@ function createUI(system)
return _groups
end

-- objects in System.World are not accessible from coders' world
local world = if system then System.World else World

-- Orthographic camera, to render UI
local camera = Camera()
camera:SetParent(World)
camera:SetParent(world)
camera.On = true
camera.Far = UI_FAR
_setLayers(camera)
Expand All @@ -206,7 +209,7 @@ function createUI(system)
sharedUIRootFrame = rootFrame
end

rootFrame:SetParent(World)
rootFrame:SetParent(world)
rootFrame.LocalPosition = { -Screen.Width * 0.5, -Screen.Height * 0.5, UI_FAR }

local function _setupUIObject(object, collides)
Expand Down Expand Up @@ -1245,7 +1248,12 @@ function createUI(system)
end

ui.show = function(_)
rootFrame:SetParent(World)
if rootFrame == systemUIRootFrame then
if System == nil then return end -- shouldn't be touching that if world doesn't have access to System
rootFrame:SetParent(System.World)
else
rootFrame:SetParent(World)
end
end

ui.turnOff = function(_)
Expand Down