Wednesday, 15 February 2012

unity3d - how to properly use getComponants to get a audio array? -


OK, so I got this code that I shrink in a line:

  GameObject GetComponents (AudioSource) [0] .audio.Play ();   

This row gives me this error:

  Invalid cast exception: Can not insert destination type from source type. Start scripting + $ $ 4 $$. MoveNext () (at Assets / scriptexplosion.js: 7)   

My question is how do I change the array of components in an array of Oreosors?

gameObject.GetComponents & lt; Audio processing & gt; ();

No comments:

Post a Comment