private void ShowBindOptions() { //Bind variable GUILayout.BeginHorizontal(); if (!_target_variable.is_field_binded && !_target_variable.is_method_binded) { //Free space margin GUILayout.FlexibleSpace(); //Generate variable bind selection dropdown ProTools.GenerateButtonDropdownMenu(ref _variable_dropdown_data.selected_index, _variable_dropdown_data.display_paths, "V", false, 40.0f, _variable_dropdown_data.dropdown_slot); //Generate method bind selection dropdown ProTools.GenerateButtonDropdownMenu(ref _method_dropdown_data.selected_index, _method_dropdown_data.display_paths, "M", false, 40.0f, _method_dropdown_data.dropdown_slot); if (_variable_dropdown_data.selected_index > -1) { //Bind variable to the new field using the selected path EditorApplication.delayCall += () => _target_variable.BindField(_variable_dropdown_data.paths[_variable_dropdown_data.selected_index]); } else if (_method_dropdown_data.selected_index > -1) { //Bind the variable to the new method using the selected path EditorApplication.delayCall += () => _target_variable.BindMethod(_method_dropdown_data.paths[_method_dropdown_data.selected_index]); EditorApplication.delayCall += () => _has_method_parameters = ProTools.FindMethodFromPath(_target_variable.binded_method_path, _target_variable.system_type, _target_blackboard.target_agent.gameObject).Key.GetParameters().Length > 0; } } else { //Show current variable bind if (target_variable.is_field_binded) { GUILayout.Label(_target_variable.binded_field_short_path, GUILayout.MaxWidth(90.0f)); } //Show current method bind else { if (_has_method_parameters) { //If the variables is method binded we show the field inheritance path if (GUILayout.Button(_target_variable.binded_method_short_path, GUILayout.MaxWidth(90.0f))) { Vector2 mousePos = Event.current.mousePosition; PopupWindow.Show(new Rect(mousePos.x, mousePos.y, 0, 0), new MethodSelectMenu_GS(_target_variable)); } } else { GUILayout.Label(_target_variable.binded_method_short_path, GUILayout.MaxWidth(90.0f)); } } //Free space margin GUILayout.FlexibleSpace(); //UnBind button if (GUILayout.Button("UnBind", GUILayout.MaxWidth(50.0f))) { if (_target_variable.is_field_binded) { //Unbind varaible resetting getter/setter and field path _target_variable.UnbindField(); //Reset path index in the variables dropdown ProTools.SetDropdownIndex(_variable_dropdown_data.dropdown_slot, -1); } else { //Unbind method rersetting getter and method info _target_variable.UnbindMethod(); _has_method_parameters = false; //Reset path index in the methods dropdown ProTools.SetDropdownIndex(_method_dropdown_data.dropdown_slot, -1); } } } GUILayout.EndHorizontal(); }