• The UI Button Input component is handling the button input stuff for the UI box - and forwards the button's content information (e.g. coming from a menu screen's part or a choice in a dialogue) to the UI Content components, which in turn distribute them to the components displaying the content, e.g. an Image for an icon or a TextMesh Pro component to display a text.

    All of that is handled automatically, so if you replace the Unity Button with a UI Button component, just make sure to also select that component in the UI Button Input component to have it use the button.
    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!
  • Ok we are on the same page @gamingislove - I removed the Button Component and added my new.UI Button - again the part that is strange..

    If I left my new UI Button and the ORK UI Button Input Component on and checked, it would cause my New UI button to float around in update, I debugged the new button and it was calling a log every frame. But when I simply disabled the ORK UI INPUT BUTTON - everything works as expected, my debug only gets called once as it should. If I completely remove the UI Button Input, that’s when I lose my information for all those buttons. Just was wondering what would cause that? Does UI Inout Button run am every frame?
  • Yes, it's base class for all different inputs manages calling OnSelect and OnDeselect of the UI selectable (i.e. the button in your case) based on the selected input of the UI box.
    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!
  • @gamingislove ahh that explains it - so both that and my button were calling it which caused it to go haywire. I should unpack the source some day and take a peek but ORK runs just fine and I wouldn’t care to mess with it. Everything else I needed works just fine using reflection with the call function node - appreciate it!
  • There'll be a small update in that regard - currently the input component constantly calls the OnSelect or OnDeselect functions. The next update will change that to only calling it when needed, which also gives a small performance boost when displaying many inputs :)
    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!
  • @gamingislove - thats awesome to hear - as thats exactly what i was seeing. Thats why i love this framework - best support in the world!
  • theProject said:
    *Edit - scratch the issue with first selection. Added a couple lines of code and fixed that. Good good, just need to figure out what’s up with UI Button Input
    @theProject - I want to do something similar - do you mind sharing the code you used? I actually need to make the second selection the default. I'm sure I can figure it out, but it would be much faster to just ask my game dev buddy, right?
  • @Scyra - sorry! I’ve been focused on level design so haven’t been doing ORK related stuff - give me a bit here and I’ll post it!
  • Take your time, I've got a lot of other things I need to do before I implement this anyway.
  • edited July 2022
    @Scyra - this is how I'm tweening onFocus - or onSelected -- are you looking for how I am finding the selected like this?


    public override void OnSelect(BaseEventData eventData)
    {
    if (isSelected) return;

    isSelected = true;

    base.OnSelect(eventData);

    TweenOnFocus?.Play();
    }

    public override void OnDeselect(BaseEventData eventData)
    {
    isSelected = false;

    base.OnDeselect(eventData);

    switch (ActionOnLoseFocus)
    {
    case ActionOnLoseFocus.Stop:
    TweenOnFocus?.Stop();
    break;
    case ActionOnLoseFocus.PlayBackward:
    TweenOnFocus?.PlayBackward();
    break;
    case ActionOnLoseFocus.SetToStartingValue:
    TweenOnFocus?.Stop();
    TweenOnFocus?.SetTime(0);
    break;
    case ActionOnLoseFocus.SetToEndValue:
    TweenOnFocus?.Stop();
    TweenOnFocus?.SetTime(1);
    break;
    }
    }


    For finding the second, I think you could find children and go that route which I think I actually did when playing around with this Tween library.
    Post edited by theProject on
  • Maybe something like this @Scyra:

    if (EventSystem.current.currentSelectedGameObject.GetComponent<Button>() == scyraButton)
    {
    ButtonSelected = true;

    } else { ButtonSelected = false; }


    and then move on to the next or just search for the first? UI has put gray on my head man.
  • Ah, ok, this should be simple to do if I use a custom button with a script that plays at the beginning of each turn. Thanks. I guess we will have a new respect for UI designers now.
  • Oh yeah - having a derived UI Button is nice as extending it with tweens is great - I’m sure all of these kind of things became a lot easier with Unity's UIBuilder system using UXML, but I’m getting real used to the prefab system now.

    It’s paid off though, I’m digging the UI now and not hating it so much. Revisiting my inventory container grid layout tonight… yikes.
Sign In or Register to comment.