Quantcast
Channel: Questions in topic: "attach"
Viewing all articles
Browse latest Browse all 168

Attaching Audio source to script variable at runtime

$
0
0
I have two audio sources attached to a game object with various scripts. After a user selects a song, I want to use script A to attach the corresponding audio source to script B's variable. So far I have this in Script A but I'm not sure if that is the correct way to do this: mc.musicSource = gameObject.GetComponent().clip.name.Contains("tian_mi_mi"); Thank you for any help!

Viewing all articles
Browse latest Browse all 168

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>