15/08/20 00:39:55.54 Fb50snmM.net
>>140
これは申し訳ない
スクリプトA
public class A: MonoBehaviour {
public AudioClip SoundA;
public AudioClip SoundB;
public void PlaySoundA()
{GetComponent<AudioSource>().PlayOneShot(SoundA);}
public void PlaySoundB()
{GetComponent<AudioSource>().PlayOneShot(SoundB);; }
}
スクリプトB
public class B: MonoBehaviour {
void OnTriggerEnter(Collider other)
{
if (other.tag == "otherObj")
{
Destroy(other.gameObject);
GetComponent(B).PlaySoundA;
}
}
}
こんな感じでいいんでしょうか?