How to access public struct from diferent script ??

Hello guys can you please help me with this? i cant get it working.

  1. Here in this script i have public struct , it is inside Monobehaviour script and is initialized.I can use it within this script normally.
    public struct MenuPanels
        {
            public GameObject profilePanel;
            public GameObject clusterPanel;
            public GameObject planetPanel;
            public GameObject descriptionPanel;
            public GameObject navigationPanel;
            public GameObject popUpPanel;  

        }

2)I have other script where i have reference for first script and i want call my static class to show ui but when i use reference i made in second script no structs from first script are visible.

StaticUtils.ShowUI(firstScript.struct.variable);

Thanks for your help if someone know.


You defined the type MenuPanels but do you have an actual variable or property of the type?

I think you are missing a public MenuPanels menuPanels; line somewhere. Plus initialization of it. On the top of that the FindObjectOfType won’t find it, because it is not a Unity object.

1 Like

Solved thanks i was missing public .