#Dropdown menu in inspector

1 messages · Page 1 of 1 (latest)

fierce cedar
#

I've been searching for so long and I haven't figured out how to create a dropdown menu on the inspector that calls a function every time I select an option. does anybody know how to do that? 😭

example: if we had this dropdown menu in the inspector and we change it from integer to float, a function would be called

muted torrent
fierce cedar
muted torrent
#

Any variable of an Enum type will show up as a dropdown in the editor

fierce cedar
#

This is exactly what I want

#

so I guess that was okay

muted torrent
# fierce cedar Just like that?

Yep, but I wouldn't name something type, it's too close to the class name Type, in general it's best to avoid naming things like actual classes

fierce cedar
#

aight, changed it to heatType. And now how do I call a function depending on the heatType?

#

like, how do i get the index of heatType?

muted torrent
#

You'd just check if it's equal to one of the types

#

if (heatType == HeatmapType.Path)

fierce cedar
#

Yea, thats exactly what I just did, thanks!