Unity 3d Error error " No appropriate version of 'UnityEngine.Object.Instantiate' for the argument list '(UnityEngine.GameObject, UnityEngine.Transform, UnityEngine.Vector3, UnityEngine.Quaternion)' was found.

I’m currently on the Walkerboys Lab 4 tutorial, everything was going well till I added this block of code to make Mario shoot the fireballs. I get the following error " No appropriate version of ‘UnityEngine.Object.Instantiate’ for the argument list ‘(UnityEngine.GameObject, UnityEngine.Transform, UnityEngine.Vector3, UnityEngine.Quaternion)’ was found."

I’ve done a bit of research and they say I can’t Instantiate a String but I don’t see where I’m defining “clone” as a string. I tried making it “var clone : GameObject;” but it still does not work.

Thanks for the help in advance.

if ( canShoot )

{

var clone;

if ( Input.GetButtonDown ( "Fire1" ) && projectileFire && playerControls.moveDirection == 0)

{

    clone = Instantiate ( projectileFire, projectileSocketLeft, transform.position, transform.rotation );

    clone.rigidbody.AddForce ( -90, 0, 0 );             

}



if ( Input.GetButtonDown ( "Fire1" ) && projectileFire && playerControls.moveDirection == 1)

{

    clone = Instantiate ( projectileFire, projectileSocketRight, transform.position, transform.rotation );

    clone.rigidbody.AddForce ( 90, 0, 0 );              

}

}

else

return;

Remove the Transform from Instantiate’s call and you’re good. It’s probably projectileSocketRight.

Thanks for answering my question, once I took a look at the script again I realized just that. So silly of me to make that mistake.

Cheers,
j-