Hello 
I am working on an UI mod and learning as i go. I am using the mod ModTools by nlight to get insight of all the objects and structure.
One of the first step i have to do is searching for specific UIPanels. They are the ones who appear in the top left and show produced sliders with electricity, water, healthcare, ect.
I am searching through UIPanels with the following method/function:
Problem is: It doesnt seem to find any of the required objects e.g.:
(Library) ElectricityInfoViewPanel
(Library) FireSafetyInfoViewPanel
(Library) CrimeInfoViewPanel
ect.
Every else UIPanel object got found, only the (Library) ones dont.
While writing this i might have found the reason why: Are these UIPanels created AFTER the mod is loaded? If so, is there a way to get access to the objects or a workaround?
On second thought: This cant be, because i can find these Panels through searching for children objects (e.g. ElectricityMeter) and going up the structure with '.parent'
(I require the visibility, and position and size of these objects.)
edit: Like i said i can search the UIPanels by their children objects. However these children have to be unique. The problem in this case are Health and Crime. Both have the object with the name 'SafetyMeter' which makes it very difficult to obtain these two objects. The only way to fix this would be by checking their parents names if they are the correct UIPanel. This is probably the solution for now until i find a better way of doing it (or maybe you have an idea).
Thank your for reading this. Hopefully someone has some insight into this
unobtanium
I am working on an UI mod and learning as i go. I am using the mod ModTools by nlight to get insight of all the objects and structure.
One of the first step i have to do is searching for specific UIPanels. They are the ones who appear in the top left and show produced sliders with electricity, water, healthcare, ect.
I am searching through UIPanels with the following method/function:
Code:
var components = UnityEngine.Object.FindObjectsOfType<UIPanel>();
foreach (var c in components)
{
if (c.cachedName == panelName || c.name == panelName)
return c;
}
return null;
Problem is: It doesnt seem to find any of the required objects e.g.:
(Library) ElectricityInfoViewPanel
(Library) FireSafetyInfoViewPanel
(Library) CrimeInfoViewPanel
ect.
Every else UIPanel object got found, only the (Library) ones dont.
While writing this i might have found the reason why: Are these UIPanels created AFTER the mod is loaded? If so, is there a way to get access to the objects or a workaround?
On second thought: This cant be, because i can find these Panels through searching for children objects (e.g. ElectricityMeter) and going up the structure with '.parent'
(I require the visibility, and position and size of these objects.)
edit: Like i said i can search the UIPanels by their children objects. However these children have to be unique. The problem in this case are Health and Crime. Both have the object with the name 'SafetyMeter' which makes it very difficult to obtain these two objects. The only way to fix this would be by checking their parents names if they are the correct UIPanel. This is probably the solution for now until i find a better way of doing it (or maybe you have an idea).
Thank your for reading this. Hopefully someone has some insight into this
unobtanium
Last edited: