- Home /
What I did wrong? Unexpected symbol `,', expecting `)'
using UnityEngine; using System.Collections;
public class Shoter : MonoBehaviour {
GameObject bullet;
void Start () {
}
void Update () {
if (Input.GetButtonDown("Fier1"))
{
GameObject newBullet = Instante(bullet, Transform.position + (transform,forward*1), transform.rotation as GameObject);
newBullet.rigidbody.AddForce(Transform,forward * 10000);
}
}
}
There are a thousand of these already. You have a syntax error. Fix it...and if you really need help with that format your code properly and include the line# of the error.
Answer by getyour411 · Mar 29, 2014 at 10:51 PM
You have transform,forward
instead of transform.forward
and also Transform.position ins$$anonymous$$d of transform.position. Also ")" needs moved <---thataway at the end of GameObject);, and Transform,forward is screwy too... and probably other stuff... oh.. "Fier1" is spelled weird...
..and... GameObject bullet is a private variable that you never assign anything to, so you're trying to instantiate nothing.
...AND... Instantiate is spelled wrong also... Did you even look at your code?