- Home /
Is there anyway to select a specific component from a game object with multiple components of the same type, into a UnityEvent field?
I have two sliders for sound volume, one for music and one for sound effects. It is easy enough to set the 'On Value Changed (Single)' to dynamically control the audioSource.volume. Except that both my audio sources are on the same Main Camera game object. So I cannot seem to pick which audio source is the target of the UnityEvent 'On Value Changed (Single)'. It seems to me that this is a bug in Unity in that it is not generating its drop down menu based on instances of components and rather on types of components.
On a side note, you cannot add multiple fields of the same value into a dropdown field in a custom inspector. For example if you wanted to add two AuidoSource fields, it wipes one of them as it is a duplicate. There is no reason why it needs to do this and yet it still does. Why not just have two AuidoSource fields if you put two AuidoSource fields into the dropdown? Why? Why? Why?
This rule of no duplicates in dropdowns has gotten in my way more than once and as far as I can see it serves no purpose. So why does it exist if it does nothing useful?
Your answer
Follow this Question
Related Questions
Unity resolution dropdown duplicating 0 Answers
Unity Duplicate Event 5 Answers
GUI.TextField duplicates texts on android. 0 Answers
field-based rendering 1 Answer
Help with a field of sight 3 Answers