Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Unity 3D example finding particular component when you have multiple of the same type
- // In this example, finding a particular AudioSource (by clip name) if you have multiple sources on your object
- var music : AudioClip;
- for (var src in GetComponents.<AudioSource>()) {
- if (src.clip.name == "music") {
- music = src;
- break;
- }
- }
- music.Play();
Advertisement
Add Comment
Please, Sign In to add comment