From d231f0689804443d39054948bcd9fd4531fd8231 Mon Sep 17 00:00:00 2001 From: Arthur Cormerais Date: Fri, 1 Aug 2025 13:09:08 +0200 Subject: [PATCH] lua : uikit now uses System.World --- lua/modules/uikit.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lua/modules/uikit.lua b/lua/modules/uikit.lua index 6099b4392..0671e2421 100644 --- a/lua/modules/uikit.lua +++ b/lua/modules/uikit.lua @@ -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) @@ -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) @@ -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(_)