Note: I don’t know that i am posting it in right place or not as i am new but i have a wired problem in scripting and i want to fix it as soon as possible.
Script:
#pragma strict
var maxFallDistance = -10;
function Update ()
{
if(transform.position.y <= maxFallDistance)
{
RestartLevel ();
}
}
function RestartLevel ()
{
audio.Play();
yield WaitForSeconds (audio.clip.length);
Application.LoadLevel(“Level 1”);
}
Errors:
- Assets/Scripts/BallHealth.js(15,5): BCE0144: ‘UnityEngine.Component.audio’ is obsolete. Property audio has been deprecated. Use GetComponent() instead. (UnityUpgradable)
- Assets/Scripts/BallHealth.js(15,11): BCE0019: ‘Play’ is not a member of ‘UnityEngine.Component’.
- Assets/Scripts/BallHealth.js(16,27): BCE0144: ‘UnityEngine.Component.audio’ is obsolete. Property audio has been deprecated. Use GetComponent() instead. (UnityUpgradable)
- Assets/Scripts/BallHealth.js(16,33): BCE0019: ‘clip’ is not a member of ‘UnityEngine.Component’.