Worked on older versions of unity

I upgraded unity in my computer to version 3.4.
I want to make a simple shooting action, so I wrote this code:

if (Input.GetKeyDown("i"))
{
    var bullet = Instantiate(bulletPrefab,spawnPoint,transform.rotatin);
    bullet.rigidbody.AddForce(transform.forward * 3000);
}

This line was worked exelent on the older versions of unity but it don’t works on this version (3.4). I checked the changes in Unity 3.4 but I found nothing about “why it don’t works” or “how to fix this”.

I got this error : No appropriate version of ‘UnityEngine.Object.Instantiate’ for the argument list ‘(UnityEngine.Transform, UnityEngine.Transform, System.Object)’ was found.

What should I do so I will be able to shoot? It works on older versions.

1 Answer

1

You have a spelling error:

It should be transform.rotation:

var bullet = Instantiate(bulletPrefab,spawnPoint,transform.rotation);

That's another error. Open a new Question with the full source code.