edited February 2022 in ORK Support
Hi,

I am using Doozy UI Manager, and the components that they offer. The standard Button component is replaced with a "UIButton" component. It is custom implementation which derives from Selectable class in a kind of complicated manner. I am unable to attach the UIButton component to the "UI Button Input (Choice)" script. There may be many consequences of this, but one that is affecting me right now is that the button is not disabled when it probably should e.g. Load Game, when there is no game to load. Could you please direct a bit to help identify how to make the connection. I am attaching the class declarations as that might help.
public partial class UIButton : UISelectableComponent<UIButton>, IPointerClickHandler, ISubmitHandler {}

public abstract class UISelectableComponent<T> : UISelectable where T : UISelectable {}

public class UISelectable : Selectable, ICanvasElement, IUseMultiplayerInfo {}
Thanks

Post edited by Blitzkreig95 on
  • Since they don't base on Unity's Button component, you'll have to write a custom Makinom UI button implementation based on the UIButtonInput component.

    Here's a quick thing I put together, the UIButton needs to use the doozy UI version, Makinom also has a UIButton class, so make sure to not confuse them.
    The class overrides all uses of the Unity button - the setting will still be there, but it's not used here.

    public class ORKDoozyUIButton : GamingIsLove.Makinom.Components.UIButtonInput
    {
    // doozy UI button
    public UIButton button;

    protected override void Reset()
    {
    this.button = this.GetComponentInChildren<UIButton>();
    this.settings.mainContent.FindMainContent(this.gameObject);
    }

    public override Selectable Selectable
    {
    get { return this.button; }
    }

    protected override void Awake()
    {
    if(this.button == null)
    {
    this.button = this.GetComponentInChildren<UIButton>();
    }
    }

    public override bool Accept()
    {
    if(this.button != null)
    {
    this.button.onClick.Invoke(); // if available in doozy UI

    if(this.box != null)
    {
    this.box.InputAccepted(this.index);
    }
    return true;
    }
    return false;
    }
    }
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • The public field - UIButton, does not show in the Editor. However, the original button field is visible. Do I need to like create a DLL or should it work even if I keep the script in the Assets folder ?
  • Ah, yeah - you also need a custom inspector:

    using GamingIsLove.Makinom;
    using GamingIsLove.Makinom.Editor;
    using GamingIsLove.Makinom.Components;
    using UnityEditor;
    using UnityEngine;
    using UnityEngine.UI;
    using System.Collections.Generic;

    [CustomEditor(typeof(ORKDoozyUIButton), true)]
    public class ORKDoozyUIButtonInspector : UIButtonInputInspector
    {
    public override void OnInspectorGUI()
    {
    serializedObject.Update();
    this.ShowSerializedProperty("button");
    this.Setup(target as UIButtonInput);
    }
    }
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited February 2022
    Any article on how to create the dlls ? Never done this before.
    Post edited by Blitzkreig95 on
  • The source code projects are already pretty much set up ready-to-use.
    However, I'm not sure if that's possible when you added them to Unity.

    Usually, just unzip the source code somewhere, open the project up in Visual Studio (or any other compatible IDE of your choice) and hit build/compile solution. The DLL files will be output to the bin/Unity_2019 folder in the source code project's folder.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Maybe I am just a noob, but this is a bit tough. If I place the unzipped source code in the Unity Assets, the editor gives me hugh list of errors. If I open the source code on an IDE (without Unity), then it again gives me a hugh list of errors for not being able to detect Unity. I am trying a workaround, but it would be great if you could keep one tutorial / article that takes the creator through this in a minimalistic manner. Thanks
  • Let me be a bit more specific. There are certain namespaces that are not accessible when I try to build via the IDE - open it externally and not from Unity.

    E.g. GamingIsLove.Makinom.Schematics is not accessible

    And if I open the source code from inside Unity, the Makinom 2 solution gets built, but does not show up with a bin folder in the source code directory.

    Maybe I am approaching this the wrong way. Kindly let me know what should be done.
  • What do you want to do - do you want to use the source code in your Unity project or do you want to compile ORK/Makinom into new DLL files to replace the current ones?

    If you want to use the source code (though I haven't tested it, as that's not really the recommended way to use ORK/Makinom):
    - unzip the source code zip file somewhere (not in the Unity project)
    - copy the Editor, Framework and UISystems folders into your Unity project
    - probably remove the AssemblyInfo.cs scripts
    - remove the ORK and/or Makinom dlls from your project (depending on if you use only ORK or also Makinom source code)

    If you want to compile new DLLs:
    - unzip the source code zip file (not in the Unity project)
    - open it in Visual Studio (or another compatible IDE
    - build/compile
    - DLLs are in bin/Unity_2019/ folder
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited February 2022
    Well, I just want to recompile the source code (after adding these additional scripts), and get the DLLs for use in the project. I'll clearly outline the steps I have followed and link an image of the errors.

    1. I added 2 scripts - ORKDoozyUIButton.cs and ORKDoozyUIButtonInspector.cs in the same location as UIButtonInput.cs and UIButtonInputInspector.cs , respectively. The namespaces are as specified above.

    2. I renamed the Makinom Source Code folder to Updated Makinom Source Code.

    3. I open the Makinom solution in Rider and I see syntax highlighting that kind of indicates that some libraries are not accessible. But, I still hit the build to see what happens.

    This is what I get :

    https://drive.google.com/file/d/1nShdpTEXY5YyLwMAIpWM4-lATEQl2cR6/view?usp=sharing

    image

    I am additionally attaching how the hierarchy looks in Rider (maybe it will help) :

    https://drive.google.com/file/d/1w8XS6-77b37fSQocZWPx13wul1As1ydp/view?usp=sharing

    image

    P.S. I do get the Makinom2.dll inside the Unity_2019, but is that the right file, given the errors in the build process.

    Thanks
    Post edited by Blitzkreig95 on
  • You don't need to recompile the source code, you just need to add the scripts to your Unity project.
    You only need to recompile in case you change something in the source code.

    ORK/Makinom are extensible without having to change the source code, just add your custom scripts and you're good to go :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited February 2022
    Update: Still not working

    I thought recompiling was necessary as the Inspector script has errors, owing to the fact that the "using GamingIsLove.Makinom.Editor;" doesn't work.

    https://drive.google.com/file/d/1F4wU6dCGLsuMjLDPd_mEORxVeTRX6kLL/view?usp=sharing

    image
    Post edited by Blitzkreig95 on
  • Ah, sorry for not mentioning that - though you know that.
    Editor scripts (like the inspector one) need to be placed in Editor folders in Unity.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited February 2022
    It's working now. Thanks a bunch

    isn't Setup(target) a private method ? It's not available in the custom inspector script. I copied the Setup definition from the source code. Just wanted to point it out.
    Post edited by Blitzkreig95 on
  • Ah, yeah - can change that in future updates.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.