I’m wondering if there’s a way to tell if a GuiBase2d Instance is being rendered or not. I don’t mean this in the context of it being in the bounds of the viewport. What I’m asking is if there’s a way to tell if the instance has a valid ancestry such that can be rendered?
For example, here are some cases where the highlighted frame would render:
And here are some cases where it would not:
I am aware that it’s possible to check for this in code, but it’s not future proof b/c Roblox could change the “rules” on what is considered a valid ancestry. There’s also added complexity if you want to track if this has changed b/c you would also need to watch every instance in the ancestry path for if their Enabled or Visible properties have changed etc.
For reference GuiBase2d contains the following classes:
I’m not sure if I’m fully understanding your question, but I think you’re basically asking:
local screen = Instance.new("ScreenGui")
screen.Parent = Players.LocalPlayer.PlayerGui
local frame1 = Instance.new("Frame")
frame1.Visible = false
frame1.Parent = screen
local frame2 = Instance.new("Frame")
frame2.Parent = frame1
print(frame2.AbsoluteVisible) -- false
print(frame2.Visible) -- true
In which case, yes. Maybe the naming of the property could be changed to be more clear, but this falls in line with other absolute properties having a mismatch.
I.e. frame.AbsoluteRotation may not equal frame.Rotation
Regardless, that’s besides the point and something more relevant to a features request. Right now I’m curious if a property or methods exists for this already.
I’m fairly sure GetGuiObjectsAtPosition returns only visible guis. Using this assumption, you can check whether a gui object is actively being rendered by running this method at the guis position and checking if that object is in the returned array.
I haven’t tested this myself so I’m not sure if this works for objects in world space and objects outside of the visible viewport.
I want to know if a gui is truly visible at any given time b/c I have a “twin” frame that I’d like to match the visibility to.
I.e.
local function match(instance: GuiObject)
local frame = Instance.new("Frame")
frame.Visible = instance.AbsoluteVisible
instance:GetPropertyChangedSignal("AbsoluteVisible"):Connect(function()
frame.Visible = instance.AbsoluteVisible
end)
end
that’s too bad, I don’t see any work arounds besides making a custom property for it and listing to changes in the hierarchy
@VegetationBush, can’t use that method based on this reply from staff
I think what you can do is listening to Visible and Enabled properties up the hierarchy
since it has a cascading effect where if the parent is not visible the child also wouldn’t be you can make an algorithm that only checks the parent’s visibility instead of the entire tree, Attributes should be helpful in this regard, shouldn’t be too expensive based on given information
I’m not sure if this will help, but TextLabel.TextBounds are 0, 0 (or not the correct TextBounds size) when not rendered. When they are rendered, they update to the correct TextBounds size.
In my game, I use this to check if the TextLabel is updated and update the frame it’s inside to fit the text length.