Assigning button text

NodeCanvas Forums General Discussion Assigning button text

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #16652
    jgwinner
    Participant

    I have some friends that are developing an app. They aren’t programmers.

    Their need is fairly simple; they have a series of videos, and wanted buttons below the videos. The button text would change based on the state machine.

    First, the user will watch a tutorial. Then the first button changes text to “Choice A”, and the second button will say “Choice B”.

    Then based on “choice A” or choice “B” they’ll watch another video. Then the buttons might change to “Choice C” and “Choice D”, and up to 1 additional button would unhide and say “Return to start” or something.

    I thought nodeCanvas could work, with an FSM. A sequencer could use the button presses to set the text and hide/unhide the buttons.

    i.e. the FSM would start, play the intro video, then unhide the two canvas buttons, and assign the appropriate text values to them.

    For some reason, I’m having a hard time wrapping my head around how to do that. It’s like we’re noun verb instead of verb noun.

    I thought I’d have a Start event, that would kick off the first video. On the video finish event, an Action State would assign the next MP4 file as a file name, then enable the buttons by assigning ‘true’ to their ‘enabled’ property.

    The next state woudl then continue, with the state condition being either button one or button two being pressed.

    The rest of the events would have the same setup with different strings/file names.

    BUT I don’t see a way to assign a reference to the button’s “Text” object? Just the top level game object, i.e. the UI’s button object?

    I did see if I add an FSM on the button text object, I can assign the text.

    So then it looks like what I’d do is assign an FSM to the Text object – it’s own FSM. So each button texdt would have it’s own FSM. Coordination of the different graphs would be hard, and I don’t see how to trigger say button one’s state on a button two event press.

    This seems fairly simple but I don’t really see a way to do it. Is this tool the right one for this kind of state machine?

    == John ==

    #16653
    jgwinner
    Participant

    Ok, I got a little further, I found the “If Button xxx Clicked” trigger, but it doesn’t seem to fire??

    This is the basic Unity VR template, and I copied the UI and hooked up the button one to an If Button Button_choice_one, but it never fires.

    Or maybe it’s because I’m using the mouse in play mode instead of my hand in VR mode?

    Sorry for the clueless questions …

    I’d still have the question of how I assign the text to the button. PlayMaker seems to let you ‘drill into’ an object’s components and assign values, but I may be misinterpreting from their videos.

    I’d just assign a program file, assign some public variables, and then do a simple assign statement in the c# I think, but I’m trying really hard to make it easy for my friends with no C# code.

    Attachments:
    You must be logged in to view attached files.
    #16655
    jgwinner
    Participant

    Ah! Can’t believe I missed it. You just choose “Set Property” by typing or reflected->Set Property
    Then check the box to assign an object, drag ‘Text’ down, then “set_text” with a string param is an option. You could assign Blackboard variables here I assume.

    I still have the problem that clicks aren’t doing anything; not sure if this is nodeCanvas or the VR Framework. Still working …

    From the video, I see some differences between Behaviour Tree Owner and FSM Owner; under FSM Owner I don’t see a sequence, just “ON FSM ENTER” or “Start” and with Behaviour Tree Owner, I don’t see the sequence like it shows in the videos?

    #16662
    Gavalakis
    Keymaster

    Hello John,

    Indeed you can use the tasks under the “Reflected” category for all such sort of things like get/set properties, call functions etc (blackboard variables can of course be used there, yes 🙂 ).

    Regarding the UI button click condition, I just tried this and it seems to work fine. Please note that for Unity UI interactions to work, there needs to be a Unity object in the scene called “EventSytem”. This is a Unity object you can create from the Unity menu “GameObject/UI/Event System”. Can you confirm that it exists in the scene please?

    FSMs and Behaviour Trees are quite different in how they work and as such each has its own set of nodes. In an FSM Action State all actions  can be set to run in sequence (this is the default). In Behaviour Trees there is a Sequencer node to be possible to Sequence whole branches rather than just actions, which is required for the flexibility a Behaviour Tree needs. Are you saying that you not seeing the “Sequencer” node in the Behaviour Trees node browser please?

    Let me know.

    Thank you.

    Join us on Discord: https://discord.gg/97q2Rjh

    #16906
    jgwinner
    Participant

    Hi Gavalakis. I solved the problem but honestly it’s been a while, I can’t remember and don’t have the source handy.

    Oddly I just got notification of a response a couple of days ago, maybe some email was jammed up?

    No worries, and thanks for the help.

    == John ==

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.