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
Post a Comment