You could explicitly downcast it, if you wanna get rid of that warning.
Instead of casting the thing, just use the generic explicit type-defining GetComponent, like:
var factory : AudioSource[] = gameObject.GetComponents.<AudioSource>();
You shouldn’t need to cast, after that point.
GetComponents return a Component[] - You’re storing that in your factory variable - now factory is a Component[] - In your next line, you’re assigning factory[6] which is a Component to SND_toggle_item which is an AudioSource - which inherits Behaviour, which in turn inherits Component. In other words, an AudioSource is a specific type of Component. So in your assignment, you’re trying to assign a Component to an AudioSource - Component is higher in the inheritance tree, than AudioSource - In C#, that assignment would give you an error, in JS it appears it’s giving just a warning (Another reason I don’t like JS) - It appears it’s automatically (implicitly) doing the downcast, meaning it’s down-casting factory[6] to an AudioSource to reach equivalency and type-match in your assignment. (Remember, when you assign Y to X, there has to be a type-match between them, otherwise the assignment is invalid)