Hello Guest

Author Topic: Using send message to set game variables.  (Read 3851 times)

g0tNoodles

  • Newbie
  • *
  • Posts: 3
    • View Profile
Using send message to set game variables.
« on: December 20, 2013, 12:25:21 am »
I'm trying to use a drop down menu to set the volume of my game. I have 11 items (0-100) in my index and would like to use the send message function to set the volume as well as save the variable in playerprefs.

In my own script, what would I use to receive the message of the change from the "tk2dUIDropDownMenu.cs" script and set my volume to that? I understand how SendMessage normally works but I am not sure how it works this way around.

Thanks.
« Last Edit: December 20, 2013, 02:35:43 pm by g0tNoodles »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Using send message to set game variables.
« Reply #1 on: December 20, 2013, 05:08:12 pm »
You should hook into OnSelectedItemChange, Send Message can't send any additional parameters, but it does already send a tk2dUIDropDownMenu as a parameter. Your event handler can use that to get the drop down menu, and then use dropdownmenu.SelectedItem to work out what is selected.