- Home /
Events for EditorGUILayout.Popup
I have been using EditorGUILayout.Popup for creating dropdown in EditorWindow script. I have requirement to create these Dropdown for a folder depth on selection, so are there any events like "OnSelectedvalueChanged()" that we can use to fire an event??
or any suggestion how to write a custom event would be helpful.
Regards,
Jithendra.
from the popup Documentation:
looks to me as if you need current index anyway, so it's trivial to implement an event for a change based on the parameter returned by the function compared to the one passed in.Takes the currently selected index as a parameter and returns the index selected by the user
Answer by TheBlueDogFirst · Nov 02, 2020 at 04:02 PM
you can track the change in the OnInspectorUpdate method, it is called 10 times per second.
int index = 0;
int newindex = 0;
string[] jointsList = new string[] { "Fixed Joint", "Character Joint", "Hinge Joint", "Spring Joint" };
void OnGUI()
{
index = EditorGUILayout.Popup(index, jointsList);
}
private void OnInspectorUpdate()
{
if (newindex != index)
{
newindex = index;
OuChagePopup();
}
}
void OuChagePopup()
{
// you code
}
Your answer
Follow this Question
Related Questions
Is it possible to store and display EditorGUILayout.Toggles? 0 Answers
Unity editor extension - create drag and drop (similar to Buildbox) 1 Answer
Custom editor window stopped showing up 1 Answer
why I Cant Add Multiple Objects to the "Object Field" in Editor Window? 3 Answers
Too much space between EditorGUILayout.SelectableLabel 2 Answers