playMaker

Author Topic: How do I pass Unity's Dropdown.value to FSM?[SOLVED]  (Read 4316 times)

vyn_halcyon

  • Playmaker Newbie
  • *
  • Posts: 9
    • View Profile
How do I pass Unity's Dropdown.value to FSM?[SOLVED]
« on: December 16, 2015, 02:34:41 AM »
Hi folks,

I have added a Unity dropdown menu, the tickable options of which return a value (0, 1, 2).

I want to assign each number (representing the dropbox options) a unity.gameobject to activate and disable. Sort of as a toggle.

I.e. ticking a box to make an object appear while making the other 2 objects dissapear.

My plan is to to let the dropdown.value decide which FSM event to send.

I.e.

(pseudocode)
if dropdown.value = 0
activate gameobject Nr. 1
deactivate gameobject Nr. 2
deactivate gameobject Nr. 3

if dropdown.value = 1
activate gameobject Nr. 2
deactivate gameobject Nr. 1
deactivate gameobject Nr. 3

etc.

I can also set the FSM to be "recursive" on the activation, so I can turn it into a toggle.

Anyone know a JavaScript for this sort of thing?
« Last Edit: June 27, 2016, 12:41:16 AM by jeanfabre »

Ha7den

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: How do I pass Unity's Dropdown.value to FSM?
« Reply #1 on: February 20, 2016, 08:25:03 PM »
I'm not sure if this is the easiest way but I did this by sending an event to playmaker on value change, then the FSM can get the property of the dropdown label, store it in a string, fire off an event using that string and apply the properties you need.

If anyone knows a cleaner method do let us know.


adamcrockett

  • Playmaker Newbie
  • *
  • Posts: 8
    • View Profile
Re: How do I pass Unity's Dropdown.value to FSM?
« Reply #2 on: June 26, 2016, 06:10:17 PM »
Ha7den, what events are in that listener state? Even after reading this thread, I can't figure out how to use the dropbox with FSM.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15060
  • Official Playmaker Support
    • View Profile
Re: How do I pass Unity's Dropdown.value to FSM?
« Reply #3 on: June 27, 2016, 12:40:56 AM »
Hi,

 Good point, It wasn't supported until now by the Unity UI proxy on the wiki. So I made an update and now it will work without any fiddling around.

https://twitter.com/JeanAtPlayMaker/status/747330976750018560



so you can download it from the Ecosystem or wiki


Bye,

 Jean

adamcrockett

  • Playmaker Newbie
  • *
  • Posts: 8
    • View Profile
Re: How do I pass Unity's Dropdown.value to FSM?[SOLVED]
« Reply #4 on: June 28, 2016, 01:08:11 PM »
Arg, I'm still not understanding how to set this up.

All I want to do is tie the pulldown selection value to a texture in a material, so the selection "concrete" in the pulldown triggers a "set material texture" with a concrete texture, then wood, plastic, etc.
 
here are my questions:

what specifically do I download in the ecosystem to update the pulldown menu?
how do I set up the pulldown to trigger a material change?

here's a video showing my attempt
https://www.youtube.com/watch?v=M-v_W6cHDgs


« Last Edit: June 28, 2016, 01:36:55 PM by adamcrockett »

adamcrockett

  • Playmaker Newbie
  • *
  • Posts: 8
    • View Profile
Re: How do I pass Unity's Dropdown.value to FSM?[SOLVED]
« Reply #5 on: June 28, 2016, 06:58:40 PM »
Also I'm getting "UI target is not a valid UI component" on my uGui component proxy.
« Last Edit: June 28, 2016, 07:03:09 PM by adamcrockett »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15060
  • Official Playmaker Support
    • View Profile
Re: How do I pass Unity's Dropdown.value to FSM?[SOLVED]
« Reply #6 on: June 28, 2016, 10:54:45 PM »
Hi,

 What version of Unity are you using?

Bye,

 Jean

adamcrockett

  • Playmaker Newbie
  • *
  • Posts: 8
    • View Profile
Re: How do I pass Unity's Dropdown.value to FSM?[SOLVED]
« Reply #7 on: June 29, 2016, 11:36:13 AM »
I'm using 5.3.5p5

I got everything working by starting a new project and re downloading and importing all the playmaker packages having to do with the uGUI.


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15060
  • Official Playmaker Support
    • View Profile
Re: How do I pass Unity's Dropdown.value to FSM?[SOLVED]
« Reply #8 on: July 01, 2016, 12:24:35 AM »
Hi,

 ok, so you could also update on your existing project right?

Bye,

 Jean