Errors in my script
BCE0019: 'Play' is not a member of 'UnityEngine.Component'. BCE0144: 'UnityEngine.Component.audio' is obsolete. Property audio has been deprecated. Use GetComponent() instead. (UnityUpgradable) BCE0019: 'pitch' is not a member of 'UnityEngine.Component'. BCE0144: 'UnityEngine.Component.audio' is obsolete. Property audio has been deprecated. Use GetComponent() instead. (UnityUpgradable) BCE0019: 'clip' is not a member of 'UnityEngine.Component'. BCE0144: 'UnityEngine.Component.audio' is obsolete. Property audio has been deprecated. Use GetComponent() instead. (UnityUpgradable) Code:
pragma strict
var DlugoscDzw = 0.2; var Dwieki : AudioClip[];
function Start () { var controller : CharacterController = GetComponent(CharacterController);
while(true)
{
if(controller.isGrounded && controller.velocity.magnitude > 0.2)
{
audio.clip = Dwieki[Random.Range(0, Dwieki.length)];
audio.pitch = Random.Range(0.8f, 1.5f);
audio.Play();
yield WaitForSeconds(DlugoscDzw);
}
else
{
yield;
}
}
}
Your answer
Follow this Question
Related Questions
Expecting EOF, found public 1 Answer
How to address JavaScript erro in UnityLoader.ja 1 Answer
Unable to join player connection alternative multicast group. 1 Answer
error CS0201 1 Answer
Nav Mesh Problem with SetDestination 1 Answer