Hi I'm trying to create a simple gui based on the wiki. It looks like a panel is created. Unfortunately it is always fullscreen black. Also, I always get this error because the method that is called does something to a button that is kind of null.
[Error :Il2CppInterop] Exception in IL2CPP-to-Managed trampoline, not passing it to il2cpp: System.NullReferenceException: Object reference not set to an instance of an object.
at UniverseLib.UI.UIFactory.SetDefaultSelectableValues(Selectable selectable)
at UniverseLib.UI.UIFactory.CreateButton(GameObject parent, String name, String text, ColorBlock colors)
at UniverseLib.UI.UIFactory.CreateButton(GameObject parent, String name, String text, Nullable`1 normalColor)
at UniverseLib.UI.Panels.PanelBase.ConstructUI()
at UniverseLib.UI.Panels.PanelBase..ctor(UIBase owner)
at ShopBot.MonoBehaviours.TestWindow..ctor(UIBase owner)
at ShopBot.Gui.CraftingPanel.SubGui()
at ShopBot.Gui.CraftingPanel.Create()
at ShopBot.Gui.PanelManager.Toggle()
at ShopBot.MonoBehaviours.GuiComponent.OnGUI()
at Trampoline_VoidThisShopBot.MonoBehaviours.GuiComponentOnGUI(IntPtr , Il2CppMethodInfo* )
Window Class:
public class TestWindow : PanelBase
{
public TestWindow(UIBase owner) : base(owner) { }
public override string Name => "My Panel";
public override int MinWidth => 100;
public override int MinHeight => 200;
public override Vector2 DefaultAnchorMin => new Vector2(0.5f, 0.5f);
public override Vector2 DefaultAnchorMax => new Vector2(0.5f, 0.5f);
public override bool CanDragAndResize => true;
protected override void ConstructPanelContent()
{
Text myText = UIFactory.CreateLabel(ContentRoot, "myText", "Hello world");
UIFactory.SetLayoutElement(myText.gameObject, minWidth: 200, minHeight: 25);
}
}
Method that registers the UI 1x.
public override void SubGui()
{
UIBase myUIBase = UniversalUI.RegisterUI("TODO", Update);
TestWindow myPanel = new TestWindow(myUIBase);
}
public void Update()
{
//TODO
}
I wonder. Where is the label text and secondly why this exception always comes.
Hi I'm trying to create a simple gui based on the wiki. It looks like a panel is created. Unfortunately it is always fullscreen black. Also, I always get this error because the method that is called does something to a button that is kind of null.
Window Class:
Method that registers the UI 1x.
I wonder. Where is the label text and secondly why this exception always comes.
Thank you very much for the help.
Result: