I'm fairly new to Unity 3D and game programming (high school class). I tried to "make" a game outside of the classroom...and it isn't WORKING If you haven't seen the TornadoTwin tutorials then just know that there are turrets and a worm made out of 3 sphere game objects. Both shoot a fireBall.
After the last turret is destroyed (for now there is only 1) I want it to go to the next level. When I added the part that said to go to the next level and destroyed the turret Destroy(gameObject [the turret]) stopped working and the above error came up. I got rid of this component as a result. Since I got rid of that the turret continues to shoot before the new level loads. I want to stop that function which is in a different script(Turret Control) or disable/remove the script entirely at this point.
How should I go about fixing this? Anything with // was gotten rid of due to the error I stated and this error as well:No appropriate version of 'UnityEngine.Object.Destroy' for the argument list '(function(Object): void)' was found.
Turret Collision Script or script reffering to other script:
var fireSound : AudioClip;
var script: TurretControl;
function OnTriggerEnter( hit : Collider)
{
if(hit.gameObject.tag == "wormProjectile")
{
Destroy(hit.gameObject);
var exp = Instantiate(explosion, gameObject.transform.position, Quaternion.identity);
//Destroy(gameObject);
//script = GetComponent(TurretControl.Shoot);
// Destroy(script.Shoot)
yield WaitForSeconds (4);
Application.LoadLevel("2Scene");
}
}
//function Update ()
//{
//if(GetComponent(TurretControl))
//{
// Destroy (GetComponent(TurretControl.Shoot ()));
//}
//}
Reffered script or TurretControl Script:
function Shoot(seconds)
{
if(seconds!=savedTime)
{
var bullet = Instantiate(bulletPrefab,transform.Find("spawnPoint1").transform.position,Quaternion.identity);
bullet.gameObject.tag = "enemyProjectile";
bullet.rigidbody.AddForce(transform.forward * 1000);
savedTime = seconds;
}
}