Search Unity

Error CS1001 i´m new pls help me. its simple

Discussion in 'Scripting' started by Jujuzeetos, Dec 25, 2019.

  1. Jujuzeetos

    Jujuzeetos

    Joined:
    Dec 24, 2019
    Posts:
    2
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class Shooting : MonoBehaviour {

    public GameObject theBullet;
    public Transform barrelEnd;

    public int bulletSpeed;

    private void Update ()
    {
    if(Input.GetKey (KeyCode.Mouse0))
    {
    Shoot();
    }
    }

    void Shoot ()
    {
    var bullet = Instantiate (theBullet, barrelEnd.position, barrelEnd.rotation);
    bullet.GetComponent<Rigidbody>().velocity = bullet.;transform.foward * bulletSpeed;
    }
    }
     
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,188
    I suggest you use code tags and also list what the error is and not just the error code.

    That being said, you have a semi-colon where it doesn't belong. Right before transform.forward (also a spelling error)
    Code (CSharp):
    1. bullet.GetComponent<Rigidbody>().velocity = bullet.;transform.foward * bulletSpeed;
     
  3. Jujuzeetos

    Jujuzeetos

    Joined:
    Dec 24, 2019
    Posts:
    2
    Thanks