c# - Get AudioSource from other Gameobject -


how can use audiosource component of gameobject gameobject?.

gameobject1.audiosource

in gameobject2 use gameobject1.audiosource..

i'm using unity3d , c# lang.

please help..

perhaps looking this:

audiosource source1 = gameobject.findgameobjectwithtag("gameobject1").getcomponent<audiosource>();  getcomponent<audiosource>().clip = source1.clip; 

this finds gameobject tag (this step optional if have gameobject1) , gets clip audiosource component , copy gameobject2's audiosource. in same way can read other properties audio source1.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -