2D Toolkit Forum

2D Toolkit => Support => Topic started by: g0tNoodles on December 20, 2013, 12:25:21 am

Title: Using send message to set game variables.
Post by: g0tNoodles 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.
Title: Re: Using send message to set game variables.
Post by: unikronsoftware 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.